> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://platform.bctrl.ai/llms.txt.
> For full documentation content, see https://platform.bctrl.ai/llms-full.txt.

# Update Proxy

PATCH https://api.bctrl.ai/v2/proxies/{id}
Content-Type: application/json

Update one saved proxy. Future browser runtimes can use the updated proxy configuration.

Reference: https://platform.bctrl.ai/api/api-reference/proxies/update

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: bctrl API
  version: 1.0.0
paths:
  /v2/proxies/{id}:
    patch:
      operationId: v-2-proxies-update
      summary: Update a proxy
      description: >-
        Update one saved proxy. Future browser runtimes can use the updated
        proxy configuration.
      tags:
        - subpackage_proxies
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Use Bearer <api-key>.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/proxies_v2.proxies.update_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                config:
                  $ref: >-
                    #/components/schemas/V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfig
                name:
                  type: string
servers:
  - url: https://api.bctrl.ai
  - url: http://localhost:8787
components:
  schemas:
    V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigGeo:
      type: object
      properties:
        city:
          type: string
        country:
          type: string
        isp:
          type: string
        region:
          type: string
      title: V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigGeo
    V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigIpFamily:
      type: string
      enum:
        - dual-stack
        - ipv4-only
      title: V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigIpFamily
    V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigPool:
      type: string
      enum:
        - quality
        - quality-speed
        - speed
        - max-pool
      title: V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigPool
    V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigProtocol:
      type: string
      enum:
        - http
        - socks5
      title: V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigProtocol
    V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigSessionMode:
      type: string
      enum:
        - rotate
        - sticky
      title: V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigSessionMode
    V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigSession:
      type: object
      properties:
        key:
          type: string
        mode:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigSessionMode
      required:
        - mode
      title: V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigSession
    V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfig:
      type: object
      properties:
        geo:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigGeo
        host:
          type: string
        ipFamily:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigIpFamily
        password:
          type:
            - string
            - 'null'
        pool:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigPool
        port:
          type: integer
        protocol:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigProtocol
        session:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfigSession
        username:
          type:
            - string
            - 'null'
      title: V2ProxiesIdPatchRequestBodyContentApplicationJsonSchemaConfig
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf0ConfigProtocol:
      type: string
      enum:
        - http
        - socks5
      title: >-
        V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf0ConfigProtocol
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf0Config:
      type: object
      properties:
        hasPassword:
          type: boolean
        host:
          type: string
        port:
          type: integer
        protocol:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf0ConfigProtocol
        username:
          type:
            - string
            - 'null'
      required:
        - hasPassword
        - host
        - port
        - protocol
      title: V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf0Config
    ProxiesV2ProxiesUpdateResponse2000:
      type: object
      properties:
        config:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf0Config
        createdAt:
          type: string
        id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
            - custom
        updatedAt:
          type: string
      required:
        - config
        - createdAt
        - id
        - name
        - type
        - updatedAt
      title: ProxiesV2ProxiesUpdateResponse2000
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigGeo:
      type: object
      properties:
        city:
          type: string
        country:
          type: string
        isp:
          type: string
        region:
          type: string
      title: V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigGeo
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigIpFamily:
      type: string
      enum:
        - dual-stack
        - ipv4-only
      title: >-
        V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigIpFamily
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigPool:
      type: string
      enum:
        - quality
        - quality-speed
        - speed
        - max-pool
      title: V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigPool
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigProtocol:
      type: string
      enum:
        - http
        - socks5
      title: >-
        V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigProtocol
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigSessionMode:
      type: string
      enum:
        - rotate
        - sticky
      title: >-
        V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigSessionMode
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigSession:
      type: object
      properties:
        key:
          type: string
        mode:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigSessionMode
      required:
        - mode
      title: V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigSession
    V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1Config:
      type: object
      properties:
        geo:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigGeo
        ipFamily:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigIpFamily
        pool:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigPool
        protocol:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigProtocol
        session:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1ConfigSession
      title: V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1Config
    ProxiesV2ProxiesUpdateResponse2001:
      type: object
      properties:
        config:
          $ref: >-
            #/components/schemas/V2ProxiesIdPatchResponsesContentApplicationJsonSchemaOneOf1Config
        createdAt:
          type: string
        id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
            - managed-rotating
        updatedAt:
          type: string
      required:
        - config
        - createdAt
        - id
        - name
        - type
        - updatedAt
      title: ProxiesV2ProxiesUpdateResponse2001
    proxies_v2.proxies.update_Response_200:
      oneOf:
        - $ref: '#/components/schemas/ProxiesV2ProxiesUpdateResponse2000'
        - $ref: '#/components/schemas/ProxiesV2ProxiesUpdateResponse2001'
      title: proxies_v2.proxies.update_Response_200
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Use Bearer <api-key>.

```

## SDK Code Examples

```python
import requests

url = "https://api.bctrl.ai/v2/proxies/id"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.bctrl.ai/v2/proxies/id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.bctrl.ai/v2/proxies/id"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.bctrl.ai/v2/proxies/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.bctrl.ai/v2/proxies/id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.bctrl.ai/v2/proxies/id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.bctrl.ai/v2/proxies/id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bctrl.ai/v2/proxies/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```