Skip to main content
Every REST API request except /healthz needs a workspace-scoped API key, sent as a bearer token.
Shell
It is the same key and the same header as the MCP server. One key reaches both surfaces; you do not need a second credential to add the other. The REST API takes a key and nothing else. OAuth access tokens belong to the MCP server, where a client can open a browser; an API called by a script should not need a consent screen, and a key is the one credential that works where nothing can open a browser at all.

The key

Mint a key under Settings → Your assistant at app.attensira.com/settings/access, or a key for one agent with exactly the scopes it needs under Settings → Agent keys. See API keys for minting, scopes and revocation. The format is atn_live_ followed by 32 hexadecimal characters:
Key format
The key is displayed exactly once, and Attensira keeps no copy it could show you again. A lost key is replaced, not recovered.
A key never expires unless you chose an expiry when you minted it (30, 90 or 365 days; Never is the default). A key without one stays valid until you or a workspace admin revokes it, so a script you deploy once keeps running without anyone re-authorizing it. There is no rotation deadline and no maximum age.
Access tokens obtained through OAuth do expire, and the client refreshes them for you. That lifetime is a property of the token, not of this API — nothing about /v1 times out a key.

The credential names the organisation

A credential belongs to your organisation and names one workspace inside it as the default. Every /v1 endpoint takes an optional ?project=<workspace id>; omit it and the default is used. No workspace id appears in a path segment or a body field — the query parameter is the only place one can be named, and it is checked against the organisation the credential belongs to. A workspace outside it comes back 404, indistinguishable from one that does not exist, so naming an id you do not own tells you nothing. One credential therefore covers every workspace in the organisation. GET /v1/account returns them in workspaces, alongside the resolved one in project.

What a 401 means

A request with a missing, malformed or unusable key gets:
401 response
The response carries the challenge, so a client knows which scheme to retry with:
A 401 covers four different situations deliberately, and neither the message nor the challenge distinguishes them: the header was absent or the wrong shape, the credential does not exist, it was revoked, or it expired. The challenge is one constant string for all of them — a caller who could tell them apart could probe for which credentials exist. Check the key at app.attensira.com/settings/access rather than inferring from the response.
A key that is real but lacks the scope a call needs gets 403, not 401. The distinction matters: a 401 is a reason to check the key, a 403 is not, and a client that reacts to one as if it were the other throws away a working key and fails identically. See Scopes for what the 403 carries.

Scopes

A key carries named scopes. Each call needs one of them, and the check happens before the call does anything, so a refused call has no side effects. MCP and REST reach the same check with the same credential, so a tool and its endpoint are refused, or allowed, identically.

The grammar

A scope list is a set of these words, separated by spaces in this documentation and sent as a list when a key is minted:
  • read is always there. Every key holds it, whether or not it was asked for, because no other scope means anything without reading what it acts on. A key minted with no scopes holds read and nothing else.
  • The wildcard is the lane *, and only the lane. approve:*:reversible approves reversible work in every lane, and it is the only kind of approve scope that reaches a call no lane claims, such as a tool from one of your own MCP servers. There is no wildcard class, and no wildcard for any other scope: * on its own, or approve:*:*, is refused.
  • A class includes the weaker ones. The classes, weakest first, are pure, reversible and compensable. approve:offsite:compensable also approves pure and reversible work in offsite. Several approve scopes add up: approve:own_site:compensable approve:outreach:pure is a valid list.
  • At most one spend scope. A list with two is refused. spend:50, spend:50/month, spend:$50/month and spend:12.5/month are all accepted; the key is stored and shown with the canonical spelling, such as spend:50/month.
  • Case and order do not matter, and a scope listed twice counts once. GET /v1/account returns the list in canonical order.
  • write is accepted at mint as shorthand for read steer configure approve:*:reversible spend:unbounded write, the bundle a Read and write key gets. It is kept on such keys as a word of its own; see Migrating from read and write.
A scope that does not parse is refused at mint with 400, the code invalid_argument, a message saying what was wrong and the accepted forms in allowed_values. Some examples:

What no scope grants

Some things no scope grants, on any door: raising autonomy or what the agent may do unattended, raising a spend ceiling, granting consent, connecting a credential, minting a key, and approving an irreversible change. A person does those in the app. Asking for one of them at mint time, such as approve:own_site:irreversible or a word like autonomy, admin or keys, is refused with the reason, rather than ignored. Two more rules hold when a key approves, whatever its scopes: a key never approves work a run it started proposed, and no key approves an irreversible change. See Who can approve what. Raising what the agent may do on its own is refused with raise_human_only even for a key with configure; see Only a person can loosen these settings.

Calls that cost credits

Calls that cost credits need a spend scope as well as their own: POST /v1/ask, POST /v1/prompts, POST /v1/automations/{id}/runs, POST /v1/work-areas/{id}/steer, answering a question with POST /v1/inbox/tasks/{id}/answer, and POST /v1/sessions/{id}/context only when the body sets "run": true (adding context without a run needs steer alone). A key with a ceiling is checked against it before the work starts. The ceiling counts what the sessions the key started this UTC month have cost. A run already under way is not stopped when it passes the ceiling; the next paid call is refused. This applies to keys. An OAuth connection has no spend scope and no ceiling of its own, so it starts paid work with its steer scope alone; your balance and any workspace caps still apply. A context body that is not valid JSON is refused with a 400 rather than a spend refusal.

What a refusal looks like

A missing scope is a 403 whose error envelope has the code scope_denied, names the scope in required_scope and links here from fix:
403 response
A 403 for any other reason has a different code, such as raise_human_only or forbidden, and no required_scope: a key with more scopes would not change the answer. See Codes. The response carries the challenge with the same scope:
A key that has reached its monthly ceiling gets a 402 with the code insufficient_credits, details.reason set to key_spend_cap, details.cap and details.used in US dollars, and details.period, the UTC month (YYYY-MM). Wait for the next month, or ask the key’s owner for a key with a higher ceiling; only a person raises a ceiling, in the app. If the ceiling cannot be checked at that moment, the paid call is refused with a 5xx rather than let through; retry shortly. See Errors. GET /v1/account and the get_account tool return the credential’s scopes as a list, so call it first from a new integration rather than discovering a gap on a refused call.

Agent names

A key minted under Settings → Agent keys names the agent that uses it, such as grokbot. The work the key starts is credited to that agent (“via grokbot”), and an approval it gives records it as resolved_by.agent. The name is set at mint and cannot change, and no header a client sends can change it. A key minted under Settings → Your assistant names no agent. Keys are minted only in the app: no key or connection can mint one.

Signed-in connections

An OAuth connection carries read, steer and approve:*:reversible. It has no configure scope and no spend ceiling of its own. It can lower what the agent may do on its own, because that needs only steer. A call that needs configure (prompts, competitors, topics, automations, skills, webhooks, a workspace’s time zone) is refused with 403 and the code scope_denied. To make those changes from an assistant, give it an API key with configure, or make the change in the app.

Migrating from read and write

Keys minted before scopes held read, or read and write, or nothing. They were moved once, like this: A write key keeps everything it could do except approving an irreversible change. It also keeps write itself, so nothing locks it out if the change is ever rolled back. A key that held nothing used to be able to do everything, and can now only read. When a key loses something, its owner gets an email naming the date. For 14 days after the move, each call the key is losing still succeeds and carries these headers, so you can find the calls before they stop working:
After the Sunset date the call is refused with the 403 above. To keep it, mint a key with the scope it needs and swap it in.

How the token travels

The API service checks only the shape of the key at the door — the atn_live_ prefix and 32 hex characters — and rejects anything else before it can become a round trip, so a typo never reaches the backend or its logs. That check is not authentication. The token itself is forwarded verbatim to the Attensira backend, which owns the real validation: whether the key exists, revocation, expiry, scopes and per-key rate limiting. Two consequences worth knowing:
  • Redirects are never followed. A 3xx is treated as the response rather than chased, because following one could re-send a live key to another host.
  • A key is never cached or mirrored. Revoking a key at the dashboard takes effect on the next request; there is no copy of it in the API layer to go stale.

Keeping a key safe

Send it from a server, never from a browser or a mobile app — anything shipped to a client device is public, and a key with configure or spend can delete prompts and spend credits. Store it in your platform’s secret store and read it from an environment variable. A key in a committed .env, a CI log or a screenshot should be revoked and replaced rather than reasoned about. Mint one key per integration. Keys carry last_used_at, so a per-integration key is the difference between revoking one job and breaking every job you have.