API keys let you authenticate requests to the Knowledge Stack API without a user session. They are intended for server-to-server integrations where there is no interactive user login.
Pass your key in the Authorization header of every request:
Authorization: Bearer <your-api-key>
The full key value is only returned once, immediately after creation. Store it securely — you cannot retrieve it again.
Create API key
Creates a new API key and returns its full value. Store the returned key immediately.
POST https://api-staging.knowledgestack.ai/v1/api-keys
A human-readable label for this key (1–100 characters). Use a descriptive name so you can identify the key’s purpose later.
Example
curl -X POST https://api-staging.knowledgestack.ai/v1/api-keys \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"name": "production-ingest-service"}'
Response — CreateApiKeyResponse
The label you assigned to this key.
The full API key value. This is the only time it will be shown. Copy it now and store it securely (e.g. in a secrets manager).
The last few characters of the key, shown in list views so you can identify keys without exposing the full value.
ISO 8601 timestamp of key creation.
Example response
{
"id": "k1k2k3k4-...",
"name": "production-ingest-service",
"key": "ks_live_abcdefghijklmnopqrstuvwxyz123456",
"key_suffix": "3456",
"created_at": "2026-04-04T10:00:00Z"
}
List API keys
Returns metadata for all API keys in the current tenant. The full key value is never returned in list or get responses.
GET https://api-staging.knowledgestack.ai/v1/api-keys
Number of results per page.
Example
curl https://api-staging.knowledgestack.ai/v1/api-keys \
-H "Authorization: Bearer <your-api-key>"
Response — PaginatedResponse[ApiKeyResponse]
Label assigned to the key.
Last few characters of the key for identification purposes.
ISO 8601 timestamp of key creation.
Get API key
Returns metadata for a single API key. The full key value is not included.
GET https://api-staging.knowledgestack.ai/v1/api-keys/{api_key_id}
Example
curl https://api-staging.knowledgestack.ai/v1/api-keys/k1k2k3k4-... \
-H "Authorization: Bearer <your-api-key>"
Response — ApiKeyResponse
Revoke API key
Permanently deletes an API key. Any requests using this key will immediately start returning 401 Unauthorized.
DELETE https://api-staging.knowledgestack.ai/v1/api-keys/{api_key_id}
UUID of the API key to revoke.
Revocation is immediate and irreversible. Ensure you’ve rotated the key in all services that use it before revoking.
Example
curl -X DELETE https://api-staging.knowledgestack.ai/v1/api-keys/k1k2k3k4-... \
-H "Authorization: Bearer <your-api-key>"