POST /api/v1/tenants/{tid}/api-keys
Generated from the OpenAPI contract. Sessions send the CSRF header on writes; API keys use a Bearer token. Authentication
POST
/api/v1/tenants/{tid}/api-keysAuthentication: session cookie __Host-panel_session (contract default; see Authentication).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tid | path | string | required | |
X-CSRF-Token | header | string | optional | Required on unsafe requests authenticated by session cookie; API keys do not use it. |
Request body
required
Content type: application/json
object
- no other properties
namestring requiredpermissionsarray<string> requiredttl_hoursinteger required- minimum 1
- maximum 8760
Example
{
"name": "string",
"permissions": [
"string"
],
"ttl_hours": 1
}Responses
201 API key and its one-time token
Content type: application/json
idstring requiredtenant_idstring requiredowner_user_idstring requirednamestring requiredcreated_atstring (date-time) requiredexpires_atstring (date-time) requiredlast_used_atstring (date-time) | null requiredmfa_backedboolean requiredThe session that made the key had passed two-step verification (ADR 0103).
refused_for_mfaboolean requiredThe key does not authenticate now because its owner's role requires two-step verification and the key was made without it, or the owner has no factor (API_KEY_MFA_REQUIRED).
tokenstring required
Example
{
"api_key": {
"id": "string",
"tenant_id": "string",
"owner_user_id": "string",
"name": "string",
"created_at": "2026-01-01T00:00:00Z",
"expires_at": "2026-01-01T00:00:00Z",
"last_used_at": "2026-01-01T00:00:00Z",
"mfa_backed": true,
"refused_for_mfa": true
},
"token": "string"
}default Error
Content type: application/json
codestring requiredmessagestring requireddetails_redactedboolean requiredcorrelation_idstring requiredretryableboolean required