Mint a new API key
/keysMints a new API key for the manager you are signed in as. The response carries the key
itself in api_key. It is shown once: store it now. It cannot be retrieved later, and
it is never shown by GET /keys.
You may hold at most 10 active keys; revoke one before minting an 11th. You may also make
at most 20 self-service mints in any 24 hours, revoked ones included (429 key_mint_limit);
keys Treasures issues for you do not count. If you hit it, wait, or ask Treasures to issue one.
Minting requires a recent sign-in: if you last signed in to the dashboard more than 15
minutes ago, the request is refused 403 reauth_required; sign out and in again, then
retry. Only signing in counts. Linking a new login method (an email, a social account or a
wallet) to a signed-in session does not, and neither does a login method first linked in
the last 15 minutes, so sign in with one you have held longer.
Treasures confirms the sign-in with its identity provider on every mint; if that check
cannot complete, the mint is refused 503 sign_in_check_unavailable and nothing is
created; retry shortly.
If the response is lost (a timeout, or a retried request), the key exists but its value cannot be recovered, and it counts toward your 10. List your keys and revoke the one you never received. There is no idempotent replay, because replaying would require storing the key's value.
Only a dashboard session may call this; an API key is refused 403 session_required, so a
key can never mint its own replacement. No query parameters are accepted.
Request
Responses
- 201
- 400
- 401
- 403
- 409
- 415
- 429
- 503
Minted. api_key is shown once; store it now. It cannot be retrieved later. Sent with Cache-Control: private, no-store.
invalid_request: a query parameter was sent, the body is not valid JSON, label is missing, blank, longer than 100 characters or not a string, or the body has a field other than label.
unauthorized: no credential was sent at all (breaking change: this used to beinvalid_api_key), or a dashboard session failed verification: the access token is missing, malformed or expired, or the identity token is missing or belongs to a different login.invalid_api_key:X-API-Keyis malformed, unknown, or belongs to a different Treasures API.key_revoked: this key has been revoked; mint a new one or ask Treasures.
reauth_required: your last dashboard sign-in was more than 15 minutes ago, or was made with a login method first linked in the last 15 minutes; sign in again, then retry.manager_not_linkedis also answered when your login is removed from the Organization while the mint is in flight.session_required: an API key cannot manage keys; call this from a signed-in dashboard session.manager_suspended,manager_not_linked,organization_suspendedandpermission_denied(this needsapi_keys:update) as on every route.
key_limit: you already hold 10 active keys; revoke one first.
The request body was sent with a Content-Type other than application/json.
key_mint_limit: 20 self-service mints in the last 24 hours, revoked ones included; wait, or ask Treasures to issue one. No Retry-After is sent for it. Otherwise the plane's request budget, as on every route (Too many requests, with Retry-After).
Response Headers
Seconds to wait before retrying. Sent with the request-budget refusal only.
sign_in_check_unavailable: Treasures could not confirm your sign-in with its identity provider, so no key was minted. Retry shortly.