Skip to main content
POST
Create Pat
Requires an active organization — without one, the org lookup this performs fails and the request returns 404 rather than proceeding. The secret is generated here, hashed with Argon2id, and stored in the pats table (org-scoped by row-level security). Creates the paired Logto personal access token first, then the local pats row; if the local insert fails, the Logto token is deleted to avoid leaving an orphaned credential.

Auth

No scope is checked — any authenticated caller may mint a key for itself — but an active organization is required, since the key is created under the token’s organization.

Response

200 OK — same shape as one element of the List Organization API Keys response, except:

Errors

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

Label for the org API key, shown in Settings → Tokens.

expires_at
integer | null

Optional expiry as epoch milliseconds (not seconds — a value below 10^12 is rejected). Omit for a key that never expires.

Response

Successful Response

id
string
required
name
string
required
key_id
string
required
pat_key
string | null
expires_at
string | null
created_at
string | null