API keys
Scopes, per-key limits and environments.
An API key is what protects the execution surface. It belongs to a project and can only execute that project's decisions.
Authenticating
Send the key in the x-api-key header (an Authorization: Bearer <key> header works too):
curl -s -X POST https://<host>/api/v1/decisions/<key>/execute \
-H 'content-type: application/json' \
-H "x-api-key: $DECISION_API_KEY" \
-d '{ }'Scopes
A key needs the execute scope (the default when it is created). A key without it gets
403. The manage scope exists but no endpoint accepts an API key for management yet.
Storage and limits
Keys are stored as a hash plus a lookup prefix, compared in constant time, and have a per-key rate limit. The key is shown once when you create it — only its hash is kept, so copy it then and rotate by creating a new one.
Expiry, allowed addresses and rate limit
Each key can carry optional restrictions, set when you create it or changed later
(PATCH /api/v1/api-keys/:id, or the pencil in Settings). Changes apply on the next request.
| Field | Effect |
|---|---|
expires_at | After this moment the key answers 401. Omit it for a key that never expires. |
allowed_cidrs | Up to 20 CIDR ranges or single IPs. From any other address the key answers 403. |
rate_limit_override | Executions per rate-limit window for this key, instead of the installation default. |
The address is the one the API sees: behind a proxy, set TRUST_PROXY and TRUST_PROXY_HOPS, or
every request will look like it comes from the proxy. A key with allowed_cidrs is refused when the
address cannot be determined. API_KEY_RATE_LIMIT_OVERRIDE_MAX caps the override.
Environments
Every key belongs to one environment (development, staging or production by default). For a key,
latest means the version deployed to its environment, which is what lets the same decision serve
different versions to different callers. See Environments.