> 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 Limits

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

Update the configured limits for one subaccount. Null values clear a limit.

Reference: https://platform.bctrl.ai/v2/api/api-reference/account/update-limits

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: bctrl API
  version: 1.0.0
paths:
  /v2/subaccounts/{id}/limits:
    patch:
      operationId: v-2-subaccounts-limits-update
      summary: Update subaccount limits
      description: >-
        Update the configured limits for one subaccount. Null values clear a
        limit.
      tags:
        - subpackage_account
      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/account_v2.subaccounts.limits.update_Response_200
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                runs:
                  $ref: >-
                    #/components/schemas/V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaRuns
                spaces:
                  $ref: >-
                    #/components/schemas/V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaSpaces
                spend:
                  $ref: >-
                    #/components/schemas/V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaSpend
servers:
  - url: https://api.bctrl.ai
  - url: http://localhost:8787
components:
  schemas:
    V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaRuns:
      type: object
      properties:
        maxActive:
          type:
            - integer
            - 'null'
      title: V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaRuns
    V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaSpaces:
      type: object
      properties:
        max:
          type:
            - integer
            - 'null'
      title: V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaSpaces
    V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaSpend:
      type: object
      properties:
        monthlyLimitMicroUsd:
          type:
            - integer
            - 'null'
      title: V2SubaccountsIdLimitsPatchRequestBodyContentApplicationJsonSchemaSpend
    V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataRuns:
      type: object
      properties:
        maxActive:
          type:
            - integer
            - 'null'
      required:
        - maxActive
      title: V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataRuns
    V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataSpaces:
      type: object
      properties:
        max:
          type:
            - integer
            - 'null'
      required:
        - max
      title: >-
        V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataSpaces
    V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataSpend:
      type: object
      properties:
        currency:
          type: string
          enum:
            - usd
        monthlyLimitMicroUsd:
          type:
            - integer
            - 'null'
      required:
        - currency
        - monthlyLimitMicroUsd
      title: V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataSpend
    V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        runs:
          $ref: >-
            #/components/schemas/V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataRuns
        spaces:
          $ref: >-
            #/components/schemas/V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataSpaces
        spend:
          $ref: >-
            #/components/schemas/V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaDataSpend
        subaccountId:
          type: string
        updatedAt:
          type: string
      required:
        - runs
        - spaces
        - spend
        - subaccountId
        - updatedAt
      title: V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaData
    account_v2.subaccounts.limits.update_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V2SubaccountsIdLimitsPatchResponsesContentApplicationJsonSchemaData
      required:
        - data
      title: account_v2.subaccounts.limits.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/subaccounts/id/limits"

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/subaccounts/id/limits';
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/subaccounts/id/limits"

	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/subaccounts/id/limits")

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/subaccounts/id/limits")
  .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/subaccounts/id/limits', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.bctrl.ai/v2/subaccounts/id/limits");
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/subaccounts/id/limits")! 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()
```