Browse docs
On this page

API Keys

Create, scope, and revoke the credential every code-based door into this API authenticates against.

Every credential that authenticates against this API - other than your own session cookie - is the same underlying resource: an API key, differentiated only by its scope. Personal access tokens are managed from Preferences, Workspace access tokens; the two door credentials are created by the feature that consumes them, because the key is the data input - an ingest key on Connect Your Data, an alert API key on Incidents under Alerts.

Scopes

ScopePrefixAccess
read_onlyobi_ro_Read routes, including POST /v1/query, whose body carries a read-only ObiQL request.
full_accessobi_rw_Everything read_only can do, plus writes allowed by the creator's role.
ingestobi_ingest_Write-only to log ingestion. Cannot read anything back.
ticket_ingestobi_alert_Write-only to the incident ingest routes - the alert API key, created from Incidents under Alerts. See Creating an alert from an external system.

A key's scope is picked at creation and can't be widened later - rotate by creating a new key with the scope you need and revoking the old one. Every route that accepts an API key states which scopes it accepts; a key presented to a route that doesn't accept its scope is refused exactly as if no credential had been presented at all.

Keys created earlier start with lsk_ instead of obi_ (for example lsk_live_ for full access). They keep working exactly as before; new keys are always created with the obi_ prefix.

See the Query API guide for the exact supported external read routes and examples. A read_only token may call POST /v1/query; the HTTP method is POST only because ObiQL and its time range are sent in a JSON body. Queries remain reads unless the ObiQL ends in | delete.

Creating a key

  1. Open Preferences in the sidebar, then Workspace access tokens.
  2. Click + Create token.
  3. Give it a name that says what it is for, such as "Claude Code" or "CI".
  4. Choose a scope: Read-only (read_only) to search and read, or Full access (full_access) to also make changes your role allows.
  5. Choose when it expires: 30 days, 90 days (the default) or never.
  6. Click Create token, then copy the token.

The token is shown exactly once - it is stored as a SHA-256 digest, not in a form that could be shown to you again, so losing it means revoking the key and creating a new one, the same as GitHub personal access tokens or Stripe secret keys.

Authorization: Bearer obi_ro_7f2a9c4e1b8d3f0a5c6e9d2b1a4f8c07

last_used_at updates on every authenticated request, so a key that has sat unused for months is easy to spot and retire.

User access tokens

A workspace access token belongs to one workspace. A user access token belongs to you and can reach several of your workspaces, which suits an AI agent or a script that works across them. Create one from Account, User access tokens and choose which workspaces it reaches, or all of them, including ones you join later. Its prefix is obi_acct_ro_ or obi_acct_rw_.

Each request acts in one workspace, as you, with your role there. Name the workspace with the ObiStack-Workspace header, by its id or slug:

Authorization: Bearer obi_acct_ro_7f2a9c4e1b8d3f0a5c6e9d2b1a4f8c07
ObiStack-Workspace: acme-prod

A token that reaches only one workspace needs no header. A token that reaches several returns 400 workspace_required without one, and a workspace it does not reach returns 403 workspace_not_allowed. If you leave a workspace, the token stops reaching it straight away. Workspace admins do not see your user access tokens; you manage and revoke them yourself.

Revoking a key

Revocation is immediate and irreversible - the very next request made with a revoked key is refused, with no propagation delay. There is no rotate operation in the API itself: rotating a key is creating a new one with the same scope, then revoking the old one.

What accepts a key today

Most read routes, the write routes on Liveness Checks, settings and status pages, and the ingest door - each operation's Auth row in the reference is the authoritative list. Two rules decide it:

  • A personal access token goes wherever the reference says Session cookie or personal access token. read_only reads; writing needs full_access. Scope only ever narrows the workspace role of the person who created the key - it never widens it.
  • An ingest key is accepted by exactly one route, POST /v1/events, and refused with 403 everywhere else. It carries no user, so it cannot satisfy any permission check, and it cannot read a single event back - which is what makes it the key to put in a CI secret or a config file on a box you do not fully trust.

Creating, listing, and revoking keys is deliberately not in that list: those require a signed-in session, so a leaked key cannot mint itself a better one.

Tenant Isolation & Data Boundaries

A key is scoped to exactly the workspace it was created in, derived server-side from the session that created it - never from anything supplied in the request that creates or uses one. Resolving a key's secret back to a workspace is one lookup, keyed on a SHA-256 digest of the secret, that excludes a revoked or expired key in the same query - there is no cache anywhere in that path that could serve a stale answer after revocation. A route only ever becomes reachable by a key if it explicitly names which scopes it accepts; nothing is reachable by a key by default. See Tenant Isolation for the full cross-feature model.