Skip to content
Last updated

Update organization, total API key, and/or individual API key spending limits. Supports updating any combination of limits in a single request.

PUThttps://api.aitronos.com/v1/analytics/usage/limits/{org_id}

Limit Hierarchy

The system enforces a three-tier limit hierarchy:

  1. Organization Limit (monthly_api_limit) - Total spending across all usage types
  2. Total API Key Limit (total_api_key_limit) - Combined spending of all API keys
  3. 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.

Update Options

This endpoint supports multiple update scenarios:

  1. Update Organization Limit Only - Provide monthly_api_limit
  2. Update Total API Key Limit Only - Provide total_api_key_limit
  3. Update Individual API Key Limit Only - Provide api_key_id + api_key_limit
  4. Update Multiple Limits - Provide any combination of the above fields

Path Parameters

org_id string required

The organization ID (format: org_<uuid>).

Request Body

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

Returns a success message and the updated limit values when limits are updated successfully. Updates are atomic - all changes succeed or all fail.

Bash
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
  }
}