Skip to main content
Every request to the Brain API must carry an API key. You create keys in the Alfera app under Settings → API Keys. Each key has scopes (what it may do) and an audience (how much of the brain it may see).

Create a key

  1. Open the Alfera app and go to Settings → API Keys.
  2. Click Create key.
  3. Choose at least one scope and pick an audience.
  4. Copy the secret immediately. It is shown once at creation and cannot be recovered later.
The secret starts with 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 the Authorization header:
If your client cannot set an Authorization header, X-Api-Key works too:

Rate limits

Each key gets 120 requests per 60-second window. Past that, requests return 429 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 in data. Every failure is wrapped in error with a stable code you can switch on.