Authentication

API keys and scopes, OAuth for MCP clients and your own apps, and device sign-in for the Indrava command line.

Embed
Preview of the card
<a href="https://indrava.forumulate.com/docs/authentication"><img src="https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/pages/a19cfcc9-fec3-4877-8e08-e10f48cd4595/social-card.svg?v=3e7ae33eec8b" alt="Authentication" width="600" height="315"></a>

Every request to /api/v1 and /mcp carries a bearer token (the exceptions are marked "public, no token needed" on the operations page, such as the list of platforms, GET /api/v1/channels/providers):

Authorization: Bearer <token>

The token is one of two things: an API key of a workspace, or an OAuth access token that a person approved for a client such as the command line or an MCP client. Both act inside one workspace and both are limited by scopes. A browser session of the web app is not accepted on the public API.

API keys

A workspace admin creates, names and revokes keys in the app, on the Developers screen. A key:

  • belongs to the workspace, not to a person. What it creates is recorded as written by the member who made the key.

  • is shown once, when it is created. Store it in a secret manager.

  • carries the scopes chosen when it was made. A key with no scopes can call nothing.

  • can be read-only: only the read scopes are kept, so every write is refused.

  • can be limited to clients: it then sees only those clients' channels, posts and media (and the media that belong to no client are hidden, as for a member restricted to clients). Such a key cannot manage webhooks or list the team. Delete a client and its keys see nothing of it, never everything.

  • can be revoked at any time. A revoked key can keep working for up to 60 seconds, because the API remembers a successful check for that long.

To rotate a key, make a new one with the same scopes, switch your integration to it, check GET /me with it, then revoke the old one.

Indrava does not store API keys. Its identity service keeps and checks them.

Scopes

A scope names one resource and what may be done with it: posts:read, media:write. The scope an operation needs follows from its route: the first path segment, then read for GET and write for every other method. GET /posts needs posts:read; POST /posts/{id}/retry needs posts:write. A write scope also covers the matching read scope, so a key with posts:write may list posts.

Scopes lists every scope with the operations it opens, and the operations page names the scope of every operation. Both are generated from the API. GET /me works with any valid key or token and returns the scopes it carries.

Publishing needs posts:publish

posts:write alone saves drafts. To put a post on the calendar, a key or token must also carry posts:publish. Without it, these are refused with 403 and the message Missing scope posts:publish: this key can only save drafts:

  • POST /posts with "action": "schedule" or "now"

  • POST /posts/{postId}/enqueue

  • POST /posts/{postId}/submit, when the post needs no approval and would be scheduled at once

  • creating or changing a recurring series, a feed or an automation, because those publish later without a person looking

mayPublish in the answer of GET /me says which kind of key you hold. A key meant for an agent that only prepares posts should be made without posts:publish.

Approval workflows

If the workspace, or the client a post belongs to, requires approval, nobody schedules that post directly: not a member in the app, and not a key. POST /posts with schedule or now is refused with 403. Save a draft, then call POST /posts/{postId}/submit: the post becomes pending_approval and the approvers are told. Submitting for approval needs only posts:write.

A key or token with approvals:write can record a decision with POST /approvals/{postId}/decision. Give that scope only to something that is meant to approve.

What keys and tokens cannot do

Managing clients, members, billing, workspace settings, API keys, report designs and link-in-bio pages stays with signed-in members, and so do the AI assistant's calls, which spend AI credits. Channels are the exception among settings: channels:write can connect, pause, rename and remove them.

An OAuth token is also limited by the role of the person who approved it: a token with posts:write held by a member whose role may not write posts is refused.

OAuth for MCP clients

The MCP server at /mcp is an OAuth protected resource. An MCP client that supports OAuth needs only the server address:

  1. The client calls /mcp without a token and gets 401 with a WWW-Authenticate header that points to /.well-known/oauth-protected-resource.

  2. That document (RFC 9728) names the authorization server and the scopes on offer.

  3. The client sends the person to sign in and approve the scopes, then calls /mcp with the access token it receives.

The token acts as the person who approved it, in one workspace, limited to the approved scopes and to what that person's role allows. If the person belongs to several workspaces, the consent screen asks which one.

Clients without OAuth support send an API key in the Authorization header instead. A client that can only be given an address can use /mcp/<API key>; the key is then part of the address, so prefer the header wherever the client can send one. See Connect an MCP client.

OAuth for your own app

A workspace admin can register an app on the Developers screen, under OAuth apps (see Team and roles). The app then uses the authorization code flow with PKCE:

  1. Read /.well-known/oauth-protected-resource for the authorization server, and that server's own metadata for its authorization and token endpoints.

  2. Send the member to the authorization endpoint with your client ID, one of the app's registered redirect addresses, a PKCE challenge, and the scopes you need out of those the app was registered with. Add openid, and offline_access if you want a refresh token.

  3. The member signs in, picks the workspace and approves. A member is asked every time an app is new to them in a workspace; consent is never skipped for a registered app.

  4. Exchange the code at the token endpoint. An app with a secret authenticates with HTTP Basic (client ID and secret); a public app sends no secret, only the PKCE verifier.

  5. Call /api/v1 or /mcp with the access token, and refresh it with the refresh token.

The token acts as the member who approved it, with the same limits as any OAuth token: the approved scopes, and what that member's role allows. Only members of the workspace that registered the app can sign in to it.

After a secret is replaced, the old one keeps working for 24 hours unless the admin chose to end it at once. An admin can revoke one member's approval, or delete the app, which ends all of its tokens.

Device sign-in for the command line

indrava login uses the OAuth device flow (RFC 8628):

  1. The command prints an address and a short code.

  2. You open the address in a browser, sign in and confirm the code.

  3. The command stores an access token and a refresh token in ~/.config/indrava/cli.json (file mode 0600) and refreshes the access token when it runs out.

Device sign-in is available when the Indrava server has a device-flow client configured. When it has not, or when you pass --key, indrava login asks for an API key and stores that instead. In CI and for agents, set INDRAVA_API_KEY and skip login altogether. See the command line reference.

When authentication fails

Status

Meaning

401

No token, or the token is unknown, revoked or expired

403 with Missing scope <scope>

The token is valid but does not carry that scope

403 with Missing scope posts:publish: ...

The token may write posts but only save them as drafts

403 with Your role does not allow <permission>

An OAuth token whose owner's role may not do this

More in Errors.

Updated