Skip to main content
POST
Mint an API key
Mint an API key for the calling principal. The plaintext is shown once. Only the SHA-256 hash is stored, so the returned apiKey is unrecoverable afterwards; id is that hash, the same opaque id GET /v1/keys lists and DELETE /v1/keys/{id} takes. The new key carries the caller’s own scopes unless the optional scopes field narrows them to a subset (a scope the caller does not hold is 403, so minting can never escalate). Signed-in dashboard sessions may mint; an API key must carry admin. Sending an Idempotency-Key makes the mint replay-safe: a retry returns the original response rather than a second credential, with apiKey replaced by a marker (the plaintext is never persisted, not even for replay).

Authorization

This route accepts any authenticated Exo API key and checks no additional scope. A missing or invalid credential returns 401 authentication_error. A valid credential without the scope returns 403 permission_denied, and the problem body names the exact scope required.

Headers

These are request conventions the contract does not declare as parameters, so they do not appear in the schema tables below.

Success responses

Errors

Beyond the shared statuses, this route can answer with idempotency_in_flight, idempotency_key_reuse. Every problem body names its own code, and the type URI always resolves to the matching page. Every error is an RFC 9457 application/problem+json body carrying a stable code, a requestId, and a suggestedAction where Exo has one. See Errors.

Notes

  • The plaintext is shown once. Only its SHA-256 hash is stored, and that hash is the id you list and revoke by.
  • Minting can never escalate. A new key carries the caller’s own scopes unless scopes narrows them to a subset. Asking for a scope you do not hold is 403.

Authorizations

X-Exo-API-Key
string
header
required

An Exo API key (exo_...) sent as the X-Exo-API-Key header.

Body

application/json
label
string | null
scopes
string[] | null

Scopes for the new key. Must be within the caller's own scopes; omit to inherit them. Vocabulary: the umbrella scopes 'read', 'write', 'admin' and the fine-grained scopes 'graph:write', 'memory:forget', 'subjects:provision', 'usage:read'. A 'write' key grants 'graph:write' and 'memory:forget'; an 'admin' key grants 'subjects:provision' and 'usage:read'. 'graph:write' does NOT grant 'memory:forget', so a key can be minted able to edit the knowledge graph but not to erase it.

Minimum array length: 1

Response

Key minted; apiKey is shown once

apiKey
string
required
id
string
required
label
string | null