# Update organization API limits div strong 🔨 In Development — This section is still being developed and may change. Adjust monthly or per-key spending limits for an organization to control usage budgets. #### Path Parameters **`orgId`** string required Unique organization identifier (format: `ORG_` + 16 chars). #### Request Body **`monthlyApiLimit`** number optional New organization-wide monthly cost cap in CHF. **`apiKeyLimit`** number optional New spending limit in CHF applied to the referenced API key. **`apiKeyId`** string optional Target API key ID (`ak_...`) when adjusting per-key limits. At least one limit field must be provided. Include both `apiKeyId` and `apiKeyLimit` to scope changes to a specific key. #### Authentication - `Authorization: Bearer $FREDDY_API_KEY` - `Content-Type: application/json` ## Returns Confirmation that requested limits were updated. Update Monthly Limit ```bash curl -X PUT "https://api.freddy.aitronos.com/v1/analytics/ORG_B66136CBB1304C98/usage/limit" \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "monthlyApiLimit": 3000.0 }' ``` ```python import requests payload = {"monthlyApiLimit": 3000.0} response = requests.put( "https://api.freddy.aitronos.com/v1/analytics/ORG_B66136CBB1304C98/usage/limit", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json=payload ) print(response.json()["message"]) ``` Update API Key Limit ```bash curl -X PUT "https://api.freddy.aitronos.com/v1/analytics/ORG_B66136CBB1304C98/usage/limit" \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "apiKeyId": "ak_5daf103fe74c8603", "apiKeyLimit": 500.0 }' ``` ```python import requests payload = { "apiKeyId": "ak_5daf103fe74c8603", "apiKeyLimit": 500.0 } response = requests.put( "https://api.freddy.aitronos.com/v1/analytics/ORG_B66136CBB1304C98/usage/limit", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json=payload ) print(response.json()["success"]) ``` ## Response 200 OK ```json { "success": true, "message": "Organization monthly limit updated to 3000.0 CHF" } ``` Errors **400 Bad Request** ```json { "error": { "message": "Payload must include a limit value", "type": "validation_error", "code": "missing_limit" } } ``` **401 Unauthorized** ```json { "error": { "message": "Authentication required", "type": "authentication_error", "code": "missing_authentication" } } ``` ## Related Resources - [Get organization usage limits](/docs/api-reference/organizations/analytics/get-usage-limit) - [Get API key usage](/docs/api-reference/organizations/analytics/get-api-key-usage)