Create API Key
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
Permissions on the new key
A key created with norole_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.
Environments
A key can be limited to one or more of your environments (for example onlystaging) from its page in the dashboard. A limited key — and every OAuth access
token minted from it — is refused with 403 when a request resolves to any other
environment, including the default environment used when a request sends no
X-KnoxCall-Environment header. The limit is read on every request, so narrowing a
key narrows the tokens it has already minted. A self-hosted proxy enforces the
limit once it runs a release that includes it, and picks up a change at its next
sync with KnoxCall (within an hour).
This endpoint does not take an environment list yet. A key created here by a key
that is limited to environments inherits the same limit, so a limited key cannot
create an unlimited one. A key created by an unlimited key, or by a person’s
token, can call every environment.
The limit bounds the routes a key calls. It does not limit what the key’s
roles let it change on this API — a key holding
Key — Editor can still edit a
workflow or route that reaches another environment.GET /v1/roles?subject_kind=api_key and pass
their ids:
A scope-narrowed OAuth access token cannot create API keys, with or without
role_ids. An API key carries no scope narrowing, so any key such a token created
would exceed the token’s own grant; the call returns 403 privilege_escalation.
Create keys with an API key, or with an OAuth token whose scope is not narrowed
(no scope requested, or *).