Management
Update API Key
Update an API key in the current Workspace.
Overview
Use this endpoint to update the name, usage limit, allowed models, expiry, or status of an existing user API key.
Request Body
At least one field must be provided.
| Field | Type | Default / Limits | Notes |
|---|---|---|---|
status | enum | - | active, inactive, revoked |
name | string | length 1-50 | Updated display name |
limitAmount | number | string | null | 0–100000 USD | null means unlimited; 0 prevents spend. Decimal strings support up to 6 decimal places. |
limitCurrency | enum | default USD | USD only. Sending CNY returns 400 currency_retired. When set, limitAmount is required. |
models | string[] | - | Updated model allowlist |
deliveryPolicy | string | null | auto, verified, official, null | null inherits the Workspace delivery policy. |
expiresAt | string | null | RFC3339 datetime | null clears the expiry |
Notes
-
Monetary fields are USD-only.
CNYinputs are retired and return400 currency_retired. -
The Management API does not provide deletion. Use
inactivefor a temporary pause andrevokedto retire a key permanently. -
Replace a revoked key with a new one.
Request
curl -X PATCH "https://api.tokenlab.sh/v1/management/api-keys/key_abc123def456" \
-H "Authorization: Bearer mt-your-management-token" \
-H "Content-Type: application/json" \
-d '{
"status": "inactive",
"limitAmount": 0
}'Request / Response
This page provides the OpenAPI schema and copyable request examples. Send management requests from your terminal or client with a Management Token; direct sending is not available on this page.
Response
{
"id": "key_abc123def456",
"name": "Backend Worker",
"key_prefix": "sk-live...",
"status": "inactive",
"limit_amount": 0,
"limit_amount_decimal": "0",
"used_amount": 148.25,
"used_amount_decimal": "148.25",
"models": [
"gpt-5.6-luna",
"claude-3-7-sonnet"
],
"expires_at": "2026-12-31T23:59:59.000Z",
"last_used_at": "2026-07-08T03:12:45.000Z",
"created_at": "2026-07-01T10:00:00.000Z",
"delivery_policy": null
}Important fields
active, inactive, suspended, or revoked.null means unlimited.null means unlimited.auto, verified, official, null. null inherits the Workspace delivery policy.null for no expiry.null when unused.Authorization
ManagementTokenAuth Management token authentication. Create or manage Management Tokens in Dashboard > API > Management Tokens.
In: header
Path Parameters
Request Body
application/json
At least one field must be provided.
1 <= propertiesResponse
application/json
application/json
application/json
application/json
application/json
application/json