api-keys

Create an API key

Changed on

Creates a new API key scoped to an organization, project, or user. The raw API key value is returned only once in this response and cannot be retrieved later. Store it securely.

post/admin/v1/api-keys

Request

  • Base URL: / (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /admin/v1/api-keys
  • Auth: HTTP bearer

Request body

allowed_modelsstring[] nullable

Allowed models (null = all models)

budget_limit_centsinteger nullable

Budget limit in cents

budget_period'daily' | 'monthly'

Budget period for spending limits

expires_atstring date-time nullable
ip_allowliststring[] nullable

IP allowlist in CIDR notation (null = all IPs)

namestring required
rate_limit_rpminteger nullable

Requests per minute override

rate_limit_tpminteger nullable

Tokens per minute override

scopesstring[] nullable

Permission scopes (null = full access)

Response

API key created successfully. Store the key value securely - it won't be shown again.

allowed_modelsstring[] nullable

Allowed models (null = all models, supports wildcards like "gpt-4*")

budget_limit_centsinteger nullable

Budget limit in cents

budget_period'daily' | 'monthly'

Budget period for spending limits

created_atstring date-time required
expires_atstring date-time nullable
idstring uuid required
ip_allowliststring[] nullable

IP allowlist in CIDR notation (null = all IPs allowed)

key_prefixstring required

Prefix of the key (for identification without exposing full key)

last_used_atstring date-time nullable
namestring required
rate_limit_rpminteger nullable

Requests per minute override (null = use global default)

rate_limit_tpminteger nullable

Tokens per minute override (null = use global default)

revoked_atstring date-time nullable
rotated_from_key_idstring uuid nullable

ID of the key this was rotated from (for audit trail)

rotation_grace_untilstring date-time nullable

If set, this key is being rotated out but still valid until this time

scopesstring[] nullable

Permission scopes (null = full access) Valid scopes: chat, completions, embeddings, images, videos, audio, files, models, admin

keystring required

The raw API key (only shown once at creation)

Changes

    • info

      added the new optional request property

    • info

      added the optional property //// to the response with the status