Management
Create API Key
Create an API key for the current Workspace.
Overview
Create an API key in the Workspace associated with the management token. The full secret appears once, in this response.
Request Body
| Field | Type | Default / Limits | Notes |
|---|---|---|---|
name | string | optional, default Default Key, length 1-50 | Display name, trimmed server-side |
limitAmount | number | string | null | 0–100000 USD | null means unlimited; 0 prevents spend. Decimal strings support up to 6 decimal places. Omitting this field when creating a key means unlimited. |
limitCurrency | enum | default USD | USD only. Sending CNY returns 400 currency_retired. |
models | string[] | default [] | Optional model allowlist |
deliveryPolicy | string | null | auto, verified, official, null | null inherits the Workspace delivery policy. |
expiresAt | string | null | RFC3339 datetime | null means no expiry |
Notes
-
Monetary fields are USD-only.
CNYinputs are retired and return400 currency_retired. -
models: []adds no key-level model restriction. -
limitAmount: 0creates a key that is valid but cannot spend quota until updated.
Request
curl -X POST "https://api.tokenlab.sh/v1/management/api-keys" \
-H "Authorization: Bearer mt-your-management-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Backend Worker",
"limitAmount": 500,
"models": ["veo3.1", "kling-3.0-video"],
"expiresAt": "2026-12-31T23:59:59Z"
}'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": "sk-live-redacted",
"key_prefix": "sk-live...",
"status": "active",
"limit_amount": 500,
"limit_amount_decimal": "500",
"used_amount": 0,
"used_amount_decimal": "0",
"models": [
"veo3.1",
"kling-3.0-video"
],
"expires_at": "2026-12-31T23:59:59.000Z",
"last_used_at": null,
"created_at": "2026-07-08T03: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
Request Body
application/json
Response
application/json
application/json
application/json
application/json