staqlydocs
REST APIAPI referenceAuth

Create a scoped API key

Create a scoped API key (admin). The raw key is returned once.

Every request sends Authorization: Bearer ...: the access token in local mode, an API key stk_... in cloud mode. Use Send to try it against your cloud instance with your API key.

POST
/v1/api-keys

Authorization

headerAuthorizationBearer <token>

API key (stk_...), or in the Community Edition the access token (stk_local_...)

Header Parameters

Idempotency-Key?string

Replays the stored response when the same key is repeated with the same method, path, query string and body within 24 hours (422 idempotency_mismatch with a different request, 409 idempotency_in_progress while the first one runs). Not applied to multipart uploads or to responses that carry a secret.

Lengthlength <= 200

Request Body

application/json
  1. body
name*string
scopes*array<>
Items1 <= items
expires_at?string

RFC3339 or YYYY-MM-DD, in the future (422 otherwise); at most a year ahead (422 otherwise); omitted, the key expires in a year. Expired keys stop counting against the plan key limit

Response Body

Created

application/json
  1. response
id*string
name*string
prefix*string
scopes*array<>
created_at*string
last_used_at*string|null
expires_at*string|null
revoked_at*string|null
key?string

Raw secret; only in create/rotate responses

curl -X POST 'https://staqly.example.com/v1/api-keys' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "scopes": [    "collections:read"  ]}'
{  "id": "string",  "name": "string",  "prefix": "string",  "scopes": [    "collections:read"  ],  "created_at": "string",  "last_used_at": "string",  "expires_at": "string",  "revoked_at": "string",  "key": "string"}