Skip to content

API Keys

API keys provide programmatic access to Alokai CMS without requiring interactive login. They are scoped to a space and carry granular permissions.

Creating an API key

Go to Settings → API Keys and click New API Key.

FieldDescription
NameA label to identify this key
DescriptionOptional notes
PermissionsWhat actions this key can perform

Key format

default_sk_a1b2c3d4e5f6... (64 hex characters after the underscore)

The prefix (default) is stored in plain text for identification. The rest is hashed with SHA-256 before storage.

Permissions

PermissionAllows
content_readList and get pages, components, and content models
content_updateCreate, update, and publish pages and components
content_deleteDelete pages and components
users_readList users
users_updateCreate and update users

Using an API key

Pass the key in the Authorization header or the X-API-Key header:

Terminal window
# Authorization header
curl -H "Authorization: Bearer default_sk_..." \
https://your-worker.workers.dev/api/pages
# X-API-Key header
curl -H "X-API-Key: default_sk_..." \
https://your-worker.workers.dev/api/pages

Always include the space and environment context headers:

Terminal window
curl -H "Authorization: Bearer default_sk_..." \
-H "X-Alokai CMS-Space: default" \
-H "X-Alokai CMS-Environment: main" \
https://your-worker.workers.dev/api/pages

Revoking a key

Click Delete on any key in Settings → API Keys. The key is immediately invalidated.