Update organization, total API key, and/or individual API key spending limits. Supports updating any combination of limits in a single request.
The system enforces a three-tier limit hierarchy:
- Organization Limit (
monthly_api_limit) - Total spending across all usage types - Total API Key Limit (
total_api_key_limit) - Combined spending of all API keys - Individual API Key Limit (
api_key_limit) - Spending for a specific API key
Validation Rule: total_api_key_limit must not exceed monthly_api_limit.
This endpoint supports multiple update scenarios:
- Update Organization Limit Only - Provide
monthly_api_limit - Update Total API Key Limit Only - Provide
total_api_key_limit - Update Individual API Key Limit Only - Provide
api_key_id+api_key_limit - Update Multiple Limits - Provide any combination of the above fields
org_id string required
The organization ID (format: org_<uuid>).
At least one field must be provided. All limits are in CHF and must be positive numbers (> 0).
monthly_api_limit number optional
Organization monthly limit in CHF. Must be > 0. This is the total spending cap across all usage types.
total_api_key_limit number optional
Total API key monthly limit in CHF. Must be > 0 and cannot exceed monthly_api_limit. This is the combined spending cap for all API keys.
api_key_id string optional
API key ID (format: apikey_<uuid>). Required when updating an individual API key limit.
api_key_limit number optional
Individual API key monthly limit in CHF. Must be > 0. Requires api_key_id to be provided.
Returns a success message and the updated limit values when limits are updated successfully. Updates are atomic - all changes succeed or all fail.
- Bash
- Python
- JavaScript
curl -X PUT "https://api.aitronos.com/v1/analytics/usage/limits/org_abc123" \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"monthly_api_limit": 2000.00
}'Response:
{
"success": true,
"message": "Limits updated successfully",
"updated_limits": {
"organization_limit": 10000.00,
"total_api_key_limit": 7000.00,
"api_key_limit": 5000.00
}
}