Create a key
- Open the Alfera app and go to Settings → API Keys.
- Click Create key.
- Choose at least one scope and pick an audience.
- Copy the secret immediately. It is shown once at creation and cannot be recovered later.
ak_live_ in production and ak_test_ on the dev deployment. That prefix is a label, not a sandbox mode, because each environment only knows its own keys.
If you lose the secret, revoke the key and create a new one. A revoked key fails on its next request.
Scopes
A scope controls which endpoints the key may call. A key needs at least one scope.Audience
The audience controls how much of the brain the key can read.
External keys are default-deny: they never receive facts about your team, inferences, or another customer’s details. The filtering happens at retrieval, so excluded facts never reach a model or a response.
Send the key on every request
Set the key in your environment, then pass it in theAuthorization header:
Authorization header, X-Api-Key works too:
Rate limits
Each key gets 120 requests per 60-second window. Past that, requests return429 rate_limited with retry_after_seconds set to 60. The window is per key, so give each of your services its own key.
Response envelope
Every success is wrapped indata. Every failure is wrapped in error with a stable code you can switch on.