Overview
The API Key Management API allows you to create, list, update, delete, and regenerate API keys for authenticating proxy requests. API keys support model restrictions, usage limits (token-based and cost-based), and expiration dates.All API Key Management endpoints require dashboard authentication via session cookie.
Create API Key
Create a new API key with optional restrictions and limits.
Request Body
Human-readable name for the API key (1-128 characters)
List of allowed model names. If null or empty, all models are allowed.
ISO 8601 timestamp when the key should expire. If null, the key never expires.
Array of usage limit rules
Legacy field for weekly token limit. Use
limits array instead.Response
Unique key identifier (UUID)
Key name
The full API key (format:
sk-clb-{48 hex chars}). Only returned once on creation.First 16 characters of the key for identification
List of allowed models, or null for all models
Expiration timestamp
Whether the key is active
Creation timestamp
Last usage timestamp
Array of limit rules with current usage
Example Request
Example Response
Error Responses
invalid_api_key_payload: Invalid request payload (e.g., invalid limit configuration)
List API Keys
Retrieve all API keys with their metadata and current usage.
Response
Returns an array of API key objects (same structure as create response, but without thekey field).
Example Request
Example Response
Update API Key
Update an existing API key’s properties. Only provided fields are updated.
Path Parameters
The API key ID to update
Request Body
New name for the key (1-128 characters)
Updated list of allowed models
New expiration timestamp
Set to false to deactivate the key
Updated limit rules. If omitted, existing limits are preserved. See create endpoint for structure.
Set to true to reset all usage counters to zero
Response
Returns the updated API key object (same structure as list endpoint).Example Request - Deactivate Key
Example Request - Update Limits
When updating limits, existing usage state is preserved for matching rules (same type, window, and model_filter). Only the max_value can be changed without resetting usage.
Error Responses
Not Found: The specified key ID does not exist
invalid_api_key_payload: Invalid request payload
Delete API Key
Permanently delete an API key. The key will immediately stop authenticating.
Path Parameters
The API key ID to delete
Response
Returns HTTP 204 No Content on success.Example Request
Error Responses
Not Found: The specified key ID does not exist
Regenerate API Key
Generate a new key value while preserving all other properties. The old key immediately stops working.
Path Parameters
The API key ID to regenerate
Response
Returns the updated API key object with the newkey and key_prefix. The full key is only shown once.
Example Request
Example Response
Error Responses
Not Found: The specified key ID does not exist
Key Format
All API keys follow the format:sk-clb-a1b2c3d4e5f6789012345678901234567890123456789012
The system stores only the SHA256 hash of the key. The plain key is returned only during creation and regeneration.
Usage Limits
Limit Types
- total_tokens: Total input + output tokens
- input_tokens: Input tokens only
- output_tokens: Output tokens only
- cost_usd: Cost in US dollars
Limit Windows
- daily: Resets every 24 hours
- weekly: Resets every 7 days
- monthly: Resets on the 1st of each month
Model-Scoped Limits
Limits can be scoped to specific models using themodel_filter field:
model_filter: null- Applies to all requests (global limit)model_filter: "claude-opus-4-20250514"- Applies only to requests using this model
- Limits total daily tokens across all models to 1M
- Limits monthly cost for Opus requests to $50
Limit Enforcement
When a limit is exceeded, proxy requests return:Authentication
All API key management endpoints require dashboard authentication via session cookie. These endpoints are separate from the API key authentication used for proxy requests.Common Error Codes
| Code | Description |
|---|---|
invalid_api_key_payload | Request payload validation failed |
rate_limit_exceeded | API key usage limit exceeded (during proxy requests) |
model_not_allowed | Requested model not in allowed_models list (during proxy requests) |