Skip to main content
POST
Related guide: API keys guide. See the API keys guide for a walkthrough with examples.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required

Display name of the key.

Maximum string length: 100
access
object

Per-domain access level (none, read or write) for restricted keys; domain ids come from the capability catalog.

constraints
object

Expiry and other limits applied to the key.

expiration
string<date-time>

Legacy expiry as an RFC 3339 timestamp; prefer constraints.expires_at.

owner
object

Lifecycle binding: a user-owned key is revoked with the user, a service-account key outlives any user.

permission_mode
enum<string>

Permission preset; restricted keys hold only the domains granted in access.

Available options:
all,
restricted,
read_only
project_scope
object

Projects the key may reach: every project of the workspace or a single one.

projects
string[] | null

Legacy single-project binding; prefer project_scope.

Maximum array length: 1
source
enum<string>

Origin of the key; router keys are minted for the AI router.

Available options:
workspace,
router

Response

The created API key with its raw token

id
string
required

Unique identifier of the key.

name
string
required

Display name of the key.

token
string
required

The raw secret on create only; a masked display value everywhere else.

workspace_id
string
required

Workspace the key belongs to.

access
object
active
boolean
constraints
object
created
string<date-time>
created_by_id
string
expiration
string
is_legacy
boolean
last_used_at
string<date-time>
legacy_key_id
string
legacy_token_family
string
owner
object
permission_mode
enum<string>
Available options:
all,
restricted,
read_only
project_scope
object
projects
string[] | null
source
string
status
enum<string>
Available options:
active,
disabled,
revoked
token_prefix
string

Display prefix of the secret; not usable as a credential.

updated
string<date-time>
updated_by_id
string