Management

Create organization API key

Creates a new user API key for the current organization management token.

post/v1/management/api-keys

Request

  • Base URL: https://api.tokenlab.sh
  • URL: https://api.tokenlab.sh/v1/management/api-keys
  • Auth: HTTP bearer

Request body

namestring required

Display name for the user API key. Trimmed server-side. Length must be 1-50 characters.

limitAmountnumber nullable

Spending limit input in USD. null or omitted means unlimited usage, and 0 means zero quota.

limitCurrency'USD'

Currency for limitAmount. USD is the only active currency. Sending CNY returns 400 currency_retired.

modelsstring[]

Optional model allowlist. Empty array means no per-key model restriction beyond organization policy.

expiresAtstring date-time nullable

Optional RFC3339 timestamp. null means no expiry.

deliveryPolicy'auto' | 'verified' | 'official' | 'null' nullable

Per-key Delivery policy. null inherits the Workspace default.

Response

Created API key

idstring required
namestring required
key_prefixstring required
status'active' | 'inactive' | 'suspended' | 'revoked' required

Lifecycle status for the user API key: active, inactive, or revoked.

limit_amountnumber nullable required

API key spending cap in USD as a JSON number for display. null means unlimited.

used_amountnumber required

Accumulated API key usage in USD as a JSON number for display.

modelsstring[] required
expires_atstring date-time nullable required
last_used_atstring date-time nullable required
created_atstring date-time required
keystring required

Full secret API key value returned only on creation. Store it immediately.

limit_amount_decimalstring nullable required

Exact API key spending cap in USD as a decimal string. null means unlimited.

used_amount_decimalstring required

Exact accumulated API key usage in USD as a decimal string for reconciliation.

delivery_policy'auto' | 'verified' | 'official' | 'null' nullable required

Per-key Delivery policy. null inherits the Workspace default.

Changes

No recorded changes to this operation across all 1 revision of this API.