Skip to main content

Create API Key

Creates a new API key. The full key value is returned only once in the response — store it securely.
For new integrations we recommend OAuth clients or the SDK instead of long-lived API keys — short-lived tokens, scope narrowing, and no long-lived secret to store. See the Authentication guide. This endpoint remains fully supported; the examples below authenticate with a minted OAuth access token ($TOKEN).

Request Body

The key_type is set automatically based on the host the request is sent to and cannot be specified in the request body. Requests to api.knoxcall.com produce a standard key; requests to sandbox.knoxcall.com produce a test key.

Response

The api_key field contains the full key and is only returned at creation time. KnoxCall does not store the plain-text key. If you lose it, you must revoke it and create a new one.

Permissions on the new key

A key created with no role_ids holds no policy, and is therefore default-denied on every policy-gated endpoint — it authenticates, then 403s. That is the platform default since the legacy *:* auto-attach was retired, and it is almost never what you want. List the roles you can attach with GET /v1/roles?subject_kind=api_key and pass their ids:
A key can never mint a key more privileged than itself. Every rule in every requested role must be covered by a rule the calling credential already holds. If it is not, the request is refused with 403 privilege_escalation and the response names the offending grant verbatim so you can see exactly what was rejected:
Two grants can never be delegated at all by a key holding only a wildcard (*:*) rule: secret:reveal and the custody / workload-binding actions. Delegating one requires the calling key to name that exact (resource_type, action) pair literally.

Errors