v1

latestOpenAPI 3.1.0MIT2026-07-173438118.7 KB
API Keys

Create a new API key

Errors

Returns error if permissions are invalid, database error, or key generation fails

post/api/api-keys

Request body

expiresAtstring date-time nullable

When the API key should expire (optional)

namestring required

Name identifier for the new API key

permissionsstring[] nullable

Array of permissions to grant to this key

Example request

{
  "expiresAt": "2024-01-01T00:00:00Z",
  "name": "Production API Key",
  "permissions": [
    "read:posts",
    "write:posts"
  ]
}

Response

API key created successfully

createdAtstring date-time nullable

Timestamp of when the API key was just created

expiresAtstring date-time nullable

Key expiration date (when provided)

idstring uuid required

UUID of the newly created API key

isActiveboolean required

Initial active status of the new API key

keystring required

The actual API key value (only shown once during creation)

keyPrefixstring required

Prefix portion of the newly generated key

namestring required

Display name shown for this API key

permissionsstring[] required

Permissions assigned to the new API key

Example response

{
  "createdAt": "2023-01-01T00:00:00Z",
  "expiresAt": "2024-01-01T00:00:00Z",
  "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "isActive": true,
  "key": "pk_live_1234567890abcdef",
  "keyPrefix": "pk_live_",
  "name": "Production API Key",
  "permissions": [
    "read:posts",
    "write:posts"
  ]
}