Skip to main content
Every request you make to the Knock2 REST API must be authenticated with an API key. Knock2 uses the industry-standard Bearer token scheme — you include your key in an Authorization header on every HTTP request, and Knock2 validates it before processing anything. This page explains how to obtain a key, how to format the header correctly, what permissions (scopes) keys can carry, and how to interpret authentication and rate-limiting errors when they occur.

Getting your API key

Log in to the Knock2 dashboard and go to Settings → API Keys. Click Create API Key, enter a descriptive label (for example, backend-production or zapier-integration), and copy the key that appears.
Your API key is displayed only once, immediately after creation. If you navigate away without saving it, you will need to revoke the key and generate a new one. Store your key in a secrets manager or environment variable right away — never commit it to source control.
All Knock2 API keys are prefixed with kn_live_ so you can recognise them in logs and configuration files:
If you believe a key has been exposed, revoke it immediately from the Settings → API Keys page and generate a replacement. Revoking a key takes effect within seconds.

Making authenticated requests

Pass your API key in the Authorization header of every request, using the Bearer token format:
Knock2 uses Bearer token format. The Authorization header value must begin with the literal word Bearer (capital B), followed by a single space, followed by your API key. Omitting the word Bearer or using a different scheme (such as Token or Basic) will result in a 401 error.

API key scopes

When you create an API key you assign it one or more scopes. Scopes follow the principle of least privilege — grant only the permissions a given integration actually needs. A key missing the scope an endpoint requires gets a 403 Forbidden — see Authentication errors below.
A valid, correctly-scoped key can still be blocked with 402 Payment Required on every /v1 route, including GET /v1/me, if the workspace it belongs to is deactivated (is_product_slug_active = false) — see Deactivate a Tenant. This is separate from the enrichment-credit 402 and isn’t fixed by rotating keys or scopes.
GET /v1/me confirms a key is valid and returns the tenant it belongs to, but does not return the key’s scopes:

Authentication errors

A 401 Unauthorized response means Knock2 could not verify your identity. The response body follows Knock2’s standard error envelope:
A 401 response means one of three things: the Authorization header is absent, the key is malformed (for example, a truncated copy-paste), or the key has been revoked. Check each possibility in order. If you recently rotated your key, make sure all services are using the new value.
Common causes and fixes:

Rate limiting

Knock2 enforces per-key rate limits to protect the stability of the platform. If you exceed your allotted request volume, the API returns a 429 Too Many Requests response:
There is no retry_after field in the body. Instead, every API response includes the following headers so you can monitor your usage proactively and know when to retry:
Do not retry immediately on a 429. Tight retry loops will keep triggering the limit. Use exponential backoff based on the X-RateLimit-Reset header (a Unix timestamp for when the current window resets), doubling your wait on each subsequent attempt up to a reasonable cap.
Here’s a minimal exponential backoff implementation: