Authentication
API keys and OAuth 2.1 tokens, scopes, and the one rule behind both: a credential never reaches further than the person behind it.
The Era API takes two kinds of credential:
| Credential | Looks like | For |
|---|---|---|
| API key | era_… | Your own servers, scripts and CI. Created in Settings, lives until you revoke it or it expires. |
| OAuth access token | erat_… | Apps that act for someone who signs in: the era CLI (era login), AI assistants over MCP, your own app. Lasts one hour and is refreshed. |
Send either one the same way:
curl https://app.getera.io/api/v1/me -H "Authorization: Bearer $ERA_API_KEY"
# or
curl https://app.getera.io/api/v1/me -H "x-api-key: $ERA_API_KEY"The rule
Never more than the person
A key or token works as the person who created or approved it, in the one workspace it is bound to, and never reaches further than that person can in the app — right now. Every request re-reads their current access: lower their role and the credential shrinks on the next request; remove them from the workspace and it answers 401. Row rules (own records only, masked fields) apply exactly as on screen.
What a credential may do is the intersection of its scopes and the person's current access. A scope can only narrow; it never adds anything the person does not already hold. The workspace comes from the credential itself, never from a header.
Scopes
| Scope | Allows |
|---|---|
* | Everything the person can do in the chosen workspace. |
<module> | Everything the person can do in one module, e.g. retail. |
<module>:read | Read one module only, e.g. crm:read. |
<module>:<capability> | One capability, e.g. retail:manage. Each action's page in the reference says which one it needs. |
offline_access | A refresh token, so the app stays signed in. |
mcp | Use Era from an AI assistant over MCP. |
Capabilities are the same ones roles grant in Settings → Roles: read, write, manage, approve, delete, export and so on, per module.
API keys
To create and revoke keys you need the platform management permission (owners and admins, usually). See Roles.
Open settings
Go to Settings → Advanced → API keys (/settings/api-keys).
New key
Click New key and fill in the form:
| Field | What it does |
|---|---|
| Name | What the key is for, e.g. "Accounting sync". The only way to recognise it later. |
| Reaches | Which modules the key may use. Left empty, it reaches every module you can. |
| Expires | Optional. The key stops working at the end of that day. |
Copy the key
The key is shown once. Era stores only its fingerprint (a SHA-256 digest), so a lost key cannot be recovered — create a new one.
Keys start with era_. The list shows their first characters, when they were last used and their status (Active, Expiring, Expired, Revoked). Revoke key stops everything using it at once; revoked keys stay on the list so past requests can still be traced.

For an integration that should see only what it needs, either limit Reaches, or create the key from the account of a member with a narrow role. Keys Era makes for itself (paired computers, chat sessions) are refused by the API.
OAuth 2.1
Use OAuth when someone other than you will connect their own Era — a CLI, an AI assistant, an app you publish. Era runs a standard OAuth 2.1 authorization server:
| Address | |
|---|---|
| Discovery | https://app.getera.io/.well-known/oauth-authorization-server |
| Authorize | https://app.getera.io/oauth/authorize |
| Token | https://app.getera.io/api/oauth/token |
| Register a client (RFC 7591) | https://app.getera.io/api/oauth/register |
| Revoke | https://app.getera.io/api/oauth/revoke |
| Device code (RFC 8628) | https://app.getera.io/api/oauth/device/code → the person confirms at /device |
- Authorization code + PKCE (
S256, required) for apps with a browser. - Device code for terminals and devices — this is what
era loginuses (public client idera-cli). - Refresh tokens rotate on every use and last 60 days; access tokens last one hour.
- Dynamic client registration lets an MCP client register itself; no form to fill.
On the consent screen the person picks which workspace the app gets, which modules, and whether it may only read. The token is bound to that choice; asking for a wider scope later is refused, a narrower one is fine.
https://app.getera.io/oauth/authorize?response_type=code
&client_id=YOUR_CLIENT_ID
&redirect_uri=https://yourapp.example/callback
&scope=crm:read%20retail%20offline_access
&code_challenge=…&code_challenge_method=S256
&state=…curl -X POST https://app.getera.io/api/oauth/token \
-d grant_type=authorization_code -d code=CODE \
-d redirect_uri=https://yourapp.example/callback \
-d client_id=YOUR_CLIENT_ID -d code_verifier=VERIFIEREvery app a person connected is listed — and can be disconnected — under Connected apps on the same Settings → Advanced → API keys page.
Authentication errors
Every error has the same shape: { "error": { "code", "message", "status", "request_id" } }.
| Status | code | When |
|---|---|---|
401 | unauthorized | No credential. |
401 | invalid_token | Wrong, revoked or expired key or token. |
401 | not_a_member | The person behind it is no longer in the workspace. |
403 | forbidden | The credential does not hold the capability the action needs. |
404 | not_found | The record, or its whole module, is outside what the credential may reach. |
Older endpoints
The Tables and Workflows endpoints (/api/v1/tables/…, /api/v1/workflows/…) predate the generated API: they read the key only from x-api-key and apply a per-minute limit per key owner, reported in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; over the limit they answer 429 with Retry-After.