Key types
TypeNotes
readAllows GET requests on /models and /content only.
writeAllows GET, POST, PUT, and DELETE (implies read).
Using a key on /models and /content

Send the raw key in the X-Contently-Key header instead of Authorization/X-Tenant-Id. When this header is present it is used exclusively — any Authorization header on the same request is ignored, and an invalid or revoked key returns 401 rather than falling back to a Bearer token.

Results are scoped to the key's own space: reads also include tenant-wide and global models; writes are restricted to rows that exactly belong to the key's space (a write key cannot edit a tenant-wide model, and a mismatched spaceId in a create request body is rejected with 400). A model/content item belonging to a different space returns 404, the same as a genuinely missing item.

Common headers (all key management routes)
HeaderNotes
AuthorizationRequired. Bearer <token> — key management always uses the normal user login, never a key.
X-Tenant-IdRequired.

All key management routes require the caller to have the admin role in the space.

POST
/space/:id/keys
Create an API key

Creates a new key for the space. The raw key is returned once in the response and is never retrievable again — store it securely.

Request body

FieldNotes
nameRequired. A label to identify the key later.
keyTypeRequired. read or write.

Response (201)

{
  "id": 1,
  "name": "Frontend read key",
  "keyType": "read",
  "keyPrefix": "a3f9c1d2",
  "status": "active",
  "createdAt": "2026-08-15T00:00:00.000Z",
  "key": "raw-key-shown-once"
}
GET
/space/:id/keys
List API keys

Returns all keys for the space, ordered by creation date. Never includes the raw key or its hash — only keyPrefix for identification.

Response

{
  "keys": [
    {
      "id": 1,
      "name": "Frontend read key",
      "keyPrefix": "a3f9c1d2",
      "keyType": "read",
      "status": "active",
      "lastUsedAt": null,
      "createdByUserId": "user-uuid",
      "createdAt": "2026-08-15T00:00:00.000Z"
    }
  ]
}
DELETE
/space/:id/keys/:keyId
Revoke an API key

Permanently revokes the key and cannot be reactivated. Takes effect immediately on the server instance handling this request; if the API runs as more than one instance, other instances stop accepting the key once their local cache entry expires (up to API_KEY_CACHE_TTL_MS, default 5 minutes). Returns 404 if the key doesn't exist or is already revoked.

Response

{
  "success": true
}