Create Pat
PATs
Create an Organization API Key
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
Requirespats:create and an active organization, since the key is created under the token’s organization. Every default role carries pats:create: the key is minted under the caller’s own Logto user and, at exchange, carries only that user’s scopes, so it can’t grant more access than the caller already has.
Response
200 OK — same shape as one element of the List Organization API Keys response, except:
Errors
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json