DocsAPI ReferenceCreate a new API key
POST
/api/v1/api-keysGenerates a new `srvk_` prefixed API key scoped to the workspace of the calling key. The full plaintext secret is returned **only once** in the response — copy it immediately. All future reads return metadata only (prefix, expiry, last used) but never the secret. Keys can optionally have an expiry. Keys without `expires_at` never expire.
Headers
X-API-KeystringrequiredYour existing workspace API key (must have edit permissions).
Content-TypestringrequiredMust be `application/json`.
Request Body
application/json
namestringrequiredHuman-readable label to identify this key.
Example: "Production Bot Key"
expires_atstringOptional expiry datetime (ISO 8601 UTC). Omit for a key that never expires.
Example: "2027-01-01T00:00:00Z"
Responses
201Key created. Copy the `key` field now — it will not be shown again.
{
"id": 42,
"name": "Production Bot Key",
"prefix": "srvk_a1b2",
"workspace_id": "aaaaaaaa-0000-0000-0000-000000000001",
"created_at": "2026-05-12T10:00:00Z",
"last_used_at": null,
"expires_at": "2027-01-01T00:00:00Z",
"key": "srvk_ABCdefGHIjklMNOpqrSTUvwxYZ0123456789abcd"
}403API key is not bound to a workspace.
Try it live
API Configurationglobal · all endpoints
POST
https://api.serveka.com/api/v1/api-keysRequest Body
curl -X POST 'https://api.serveka.com/api/v1/api-keys' \
-H "Content-Type: application/json"\
-d '{
"name": "Production Bot Key",
"expires_at": "2027-01-01T00:00:00Z"
}'