Skip to main content

Create an API Key

Create a Regular API Key.

Request Parameters

FieldRequiredTypeDescription
nameYesstringKey name, 1–50 characters after trimming leading/trailing whitespace
key_typeNostringCan only be regular
limitNonumberDollar limit; omitted or 0 means no limit
limit_resetNostringnever, daily, weekly, monthly; default never
model_allowlistNostring[]Model allowlist, up to 1000 items
model_blocklistNostring[]Model blocklist, up to 1000 items
disabledNobooleanWhether to create in a manually disabled state; default false

Response Example (HTTP 201 Created)

{
"id": "key_01j...",
"name": "qa-automation",
"key_type": "regular",
"key": "sk-...",
"key_preview": "sk-abcd**********wxyz",
"disabled": false,
"created_at": "2026-08-04T08:00:00Z"
}
Security Notice

key is the full Regular API Key and is returned only once in the create response. Store it immediately in a secure key management system or environment variable. Do not record it in logs, screenshots, or documentation.

Idempotent Retry

The create endpoint supports the Idempotency-Key header. Replaying with the same Management Key, idempotency key, and an equivalent request within 24 hours returns the same ID and the same full key without creating a duplicate; after 24 hours but within 30 days it returns 409 idempotency_expired.

Related Endpoints

For general request conventions, data structures, and error codes, see the Key Management API overview.

Online Service