# How access works: scopes, selection, policy, roles

Every request with a token passes four checks, always in the same order. Knowing them tells you what a token can reach, and why a call was refused.

## Connections

Every token belongs to a **connection**: one person letting one client act as them. The client is your script (a personal token is its own client), your OAuth app, or an assistant. A connection holds:

- **Scopes**: the kinds of access it was given ([`posts:read`](https://beplan.io/docs/oauth/scopes/#scope-posts-read), [`posts:publish`](https://beplan.io/docs/oauth/scopes/#scope-posts-publish)…).
- **A selection**: the organizations it may touch and, in each one, either every workspace the person can see (including ones added later) or a list they picked.

There is one connection per person and client. Connecting the same app again updates that connection rather than adding one: what the person picks replaces what they picked before. (An assistant that registers itself again is a new client, so it gets a new connection.) An app's access tokens come and go every hour; the connection stays until the person or an admin ends it.

## The four locks

A request succeeds only if all four open. They are checked in this order, and the first that fails answers.

| | Lock | Refused with |
|---|---|---|
| 0 | **The token** is valid, not expired, not revoked, its app is not suspended, and its person's account is active | `401` [`UNAUTHENTICATED`](https://beplan.io/docs/api/errors/#UNAUTHENTICATED), [`TOKEN_EXPIRED`](https://beplan.io/docs/api/errors/#TOKEN_EXPIRED), [`TOKEN_REVOKED`](https://beplan.io/docs/api/errors/#TOKEN_REVOKED), [`APP_SUSPENDED`](https://beplan.io/docs/api/errors/#APP_SUSPENDED) |
| 1 | **The operation** exists in the public API, and **its scope** is in the connection | `404` [`ROUTE_NOT_FOUND`](https://beplan.io/docs/api/errors/#ROUTE_NOT_FOUND), `403` [`INSUFFICIENT_SCOPE`](https://beplan.io/docs/api/errors/#INSUFFICIENT_SCOPE) |
| 2 | **The organization** in the path is in the connection's selection, and so is the workspace | `404` [`ORGANIZATION_NOT_FOUND`](https://beplan.io/docs/api/errors/#ORGANIZATION_NOT_FOUND), `404` [`WORKSPACE_NOT_FOUND`](https://beplan.io/docs/api/errors/#WORKSPACE_NOT_FOUND) |
| 3 | **The organization's policy** lets this kind of integration in, and this client, and this scope | `403` [`INTEGRATION_BLOCKED_BY_ORGANIZATION`](https://beplan.io/docs/api/errors/#INTEGRATION_BLOCKED_BY_ORGANIZATION), [`INTEGRATION_PENDING_APPROVAL`](https://beplan.io/docs/api/errors/#INTEGRATION_PENDING_APPROVAL), [`INTEGRATION_SELECTION_TOO_NARROW`](https://beplan.io/docs/api/errors/#INTEGRATION_SELECTION_TOO_NARROW) |
| 4 | **The person's role** allows the action in that workspace, exactly as in the app (custom roles, workspace overrides, teams) | `404` [`ORGANIZATION_NOT_FOUND`](https://beplan.io/docs/api/errors/#ORGANIZATION_NOT_FOUND) or [`WORKSPACE_NOT_FOUND`](https://beplan.io/docs/api/errors/#WORKSPACE_NOT_FOUND) when they can't see it, `403` [`MISSING_PERMISSION`](https://beplan.io/docs/api/errors/#MISSING_PERMISSION) |

A method and path that is not a public operation answers `404` [`ROUTE_NOT_FOUND`](https://beplan.io/docs/api/errors/#ROUTE_NOT_FOUND) before the token is even read. After the locks come the [rate limits](https://beplan.io/docs/guides/rate-limits/) (`429`), then the operation runs with the organization's plan and quotas, as in the app: `402`, `409`, `413` and `422` answers come from there.

Why this order matters to you:

- An organization or workspace outside the selection looks **exactly like one that does not exist**: lock 2 answers `404` before policy can say anything about it. Your code can't tell "not given to me" from "never existed", by design.
- Policy answers `403` with a reason, because the person did give your connection that organization and you need to know why it stopped.
- Role changes, workspace overrides, team changes and leaving the organization take effect on the next request. A token never does more than its person can do, and it never gains anything beyond its scopes and selection when the person's role grows.

The details of each refusal, and what to do about it, are in [why a call was refused](#why-a-call-was-refused).

## Scopes

A scope is a named slice of the API. Each operation needs one scope (a few also need a second one, all listed on the operation). Reads and writes are separate, so a reporting tool never needs write access. The [scope table](https://beplan.io/docs/oauth/scopes/) lists every scope with the operations that need it.

- [`profile:read`](https://beplan.io/docs/oauth/scopes/#scope-profile-read) is always granted: it is what lets [GET /v1/me](https://beplan.io/docs/api/identity/#identity.get) say who the token is for.
- [`all`](https://beplan.io/docs/oauth/scopes/#scope-all) (**Everything my role allows**) exists only for personal tokens. It covers every scope, including ones added later. Apps and assistants never get it.
- A scope never grants a permission. A token with [`members:write`](https://beplan.io/docs/oauth/scopes/#scope-members-write) held by someone whose role can't manage members can't manage members.
- New operations that fit an existing scope join it, and connections that hold the scope can call them without asking the person again.

### Sensitive scopes

Some scopes reach other people's data or act in their name: the member list with emails, managing members and roles, organization settings, creating and deleting workspaces, managing social accounts, a creator page's audience, deal money, emailing brands, and billing. They are marked sensitive in the [scope table](https://beplan.io/docs/oauth/scopes/). For these:

- The consent screen flags them.
- An organization can switch sensitive access off. Its operations then answer `403` [`INTEGRATION_BLOCKED_BY_ORGANIZATION`](https://beplan.io/docs/api/errors/#INTEGRATION_BLOCKED_BY_ORGANIZATION) with `details.reason` `sensitive_scopes_off` and `details.scope`; everything else keeps working.
- Personal tokens can hold them. Among apps and assistants, only verified apps, private apps (they reach their own organization only) and recognized assistants can be given them; an unverified public app, or an assistant Beplan can't identify, can't.
- They are never in the default set an assistant gets.

### Organization-wide writes

[`members:write`](https://beplan.io/docs/oauth/scopes/#scope-members-write), [`roles:write`](https://beplan.io/docs/oauth/scopes/#scope-roles-write), [`organization:write`](https://beplan.io/docs/oauth/scopes/#scope-organization-write) and [`workspaces:manage`](https://beplan.io/docs/oauth/scopes/#scope-workspaces-manage) change things beyond any one workspace. They work only where the connection was given **all** the workspaces of the organization; on a narrowed selection they answer `403` [`INTEGRATION_SELECTION_TOO_NARROW`](https://beplan.io/docs/api/errors/#INTEGRATION_SELECTION_TOO_NARROW) with the scope in `details.scope`.

The same goes for the organization-level writes of [`deals:write`](https://beplan.io/docs/oauth/scopes/#scope-deals-write): the organization's Deals settings, companies and contacts. With a narrowed selection, [`deals:write`](https://beplan.io/docs/oauth/scopes/#scope-deals-write) still works for deals in the chosen workspaces, but those operations answer `403` [`INTEGRATION_SELECTION_TOO_NARROW`](https://beplan.io/docs/api/errors/#INTEGRATION_SELECTION_TOO_NARROW).

Roles and member changes made through a token can't give or take away the management of integrations and developer apps, or every permission at once: those answer `403` [`PERMISSION_APP_ONLY`](https://beplan.io/docs/api/errors/#PERMISSION_APP_ONLY) and are done in Beplan.

## What the API never reaches

No token reaches these, whatever its scopes. They are not in the API at all, so their paths answer `404` [`ROUTE_NOT_FOUND`](https://beplan.io/docs/api/errors/#ROUTE_NOT_FOUND):

- **Sign-in and account security**: passwords, email changes, two-factor, sessions, deleting the account.
- **Everything about the person rather than an organization**: profile, email preferences, invitations to accept. The one exception is [GET /v1/me](https://beplan.io/docs/api/identity/#identity.get).
- **Invitations**: inviting, resending and cancelling. An invited person stays a member after a connection is revoked, so a token can't add people. (It can change existing members' roles and teams with [`members:write`](https://beplan.io/docs/oauth/scopes/#scope-members-write).)
- **The organization's life**: deleting it, transferring ownership, leaving it.
- **Post approval decisions**: approving or rejecting is for a person in Beplan, never for a token, including the one that asked.
- **Payments**: checkout, plan changes, add-ons, the billing portal, Clips packs and hour caps. The billing overview is readable with [`billing:read`](https://beplan.io/docs/oauth/scopes/#scope-billing-read).
- **Integrations themselves**: tokens, connections, consent, organization policy, developer apps and their secrets, the organization's webhook. A token can't widen its own access or create another token.
- **Beplan staff tools**, and the app's live channels (co-editing, presence, live boards).

### No AI through the API

Nothing that runs Beplan's AI is reachable through the API or MCP: autofill, the post assistant, generated drafts. What Beplan's AI already produced from the organization's own content is readable, such as media transcripts; insight cards, post explanations and weekly stories are built from the social networks' data and are not reachable for now ([insights](https://beplan.io/docs/guides/read-insights/)). A workspace's AI settings (the tone and instructions Beplan's AI follows) are readable with [`organization:read`](https://beplan.io/docs/oauth/scopes/#scope-organization-read) and editable with [`workspaces:write`](https://beplan.io/docs/oauth/scopes/#scope-workspaces-write) ([`GET …/settings/ai`](https://beplan.io/docs/api/ai/#aiSettings.get), [`PATCH …/settings/ai`](https://beplan.io/docs/api/ai/#aiSettings.update)), since changing them runs nothing. Clips can be read and managed; starting new clips is not public.

## Organization policy

Each organization decides, for each way in (API tokens, apps, assistants):

| Mode | Effect |
|---|---|
| **Allowed** (the default) | Members connect on their own |
| **Approval** | Each new connection waits for an admin, unless the app or assistant is on the organization's allowed list. Personal tokens always wait |
| **Off** | Nobody can use that way in there, owner included. Connections already made stop |

Also per organization: whether sensitive scopes are allowed (default yes), a maximum lifetime for personal tokens (default none), blocks on specific apps, assistants or members, and **post approval** per way in (default off, see [post approval](https://beplan.io/docs/concepts/approval/)).

Policy is checked on every request, never copied into your connection: tightening it stops connections at once, relaxing it brings them back without anyone reconnecting. A personal token used on the MCP server answers to the stricter of the organization's rules for tokens and for assistants.

[GET /v1/me](https://beplan.io/docs/api/identity/#identity.get) shows where you stand: each organization has a `state` of `active`, `pending` (waiting for an admin) or `blocked` with a `reason`.

## Why a call was refused

| Code | What it means | What to do |
|---|---|---|
| `401` [`UNAUTHENTICATED`](https://beplan.io/docs/api/errors/#UNAUTHENTICATED) | No token, a malformed `Authorization` header, a token in the query string, an unknown token, an account that was banned or is being deleted, or a token used on the wrong server (an app token on MCP, an assistant token on the REST API) | Check the header. Don't retry with the same token |
| `401` [`TOKEN_EXPIRED`](https://beplan.io/docs/api/errors/#TOKEN_EXPIRED) | A personal token past its expiry | Make a new token |
| `401` [`TOKEN_REVOKED`](https://beplan.io/docs/api/errors/#TOKEN_REVOKED) | The token or connection was revoked (by the person, or after a reused refresh token) | Personal token: make a new one. App: the person must connect again |
| `401` [`APP_SUSPENDED`](https://beplan.io/docs/api/errors/#APP_SUSPENDED) | Beplan suspended the app | Contact Beplan; every token of the app stops until it is lifted |
| `403` [`INSUFFICIENT_SCOPE`](https://beplan.io/docs/api/errors/#INSUFFICIENT_SCOPE) | The connection lacks the operation's scope (`details.scope`; also in `WWW-Authenticate`) | Ask the person for it: a new token, or a new consent for an app |
| `404` [`ROUTE_NOT_FOUND`](https://beplan.io/docs/api/errors/#ROUTE_NOT_FOUND) | The method and path are not a public operation | Check the [reference](https://beplan.io/docs/api/) |
| `404` [`ORGANIZATION_NOT_FOUND`](https://beplan.io/docs/api/errors/#ORGANIZATION_NOT_FOUND) | Not in the selection, the person left, or no such organization | Read [GET /v1/me](https://beplan.io/docs/api/identity/#identity.get) again |
| `404` [`WORKSPACE_NOT_FOUND`](https://beplan.io/docs/api/errors/#WORKSPACE_NOT_FOUND) | Not in the selection, hidden from the person by their teams, or no such workspace | Read the organization's workspaces again |
| `403` [`INTEGRATION_BLOCKED_BY_ORGANIZATION`](https://beplan.io/docs/api/errors/#INTEGRATION_BLOCKED_BY_ORGANIZATION) | The organization's policy stops you there; `details.reason` says why (below) | Stop calling that organization; show the person the reason |
| `403` [`INTEGRATION_PENDING_APPROVAL`](https://beplan.io/docs/api/errors/#INTEGRATION_PENDING_APPROVAL) | An admin of that organization has to approve the connection | Wait; [`connection.approved`](https://beplan.io/docs/webhooks/events/#event-connection.approved) tells an app when it happens |
| `403` [`INTEGRATION_SELECTION_TOO_NARROW`](https://beplan.io/docs/api/errors/#INTEGRATION_SELECTION_TOO_NARROW) | An organization-wide scope on a selection of some workspaces only | The person must give the connection all workspaces |
| `403` [`MISSING_PERMISSION`](https://beplan.io/docs/api/errors/#MISSING_PERMISSION) | The person's role can't do this in that workspace | Nothing your code can fix; an admin can change the role |
| `403` [`SETTING_APP_ONLY`](https://beplan.io/docs/api/errors/#SETTING_APP_ONLY) | A setting an integration may read but only a person may change (`details.field`) | Ask the person to change it in Beplan |

`details.reason` of [`INTEGRATION_BLOCKED_BY_ORGANIZATION`](https://beplan.io/docs/api/errors/#INTEGRATION_BLOCKED_BY_ORGANIZATION):

| Reason | Cause |
|---|---|
| `feature_unavailable` | The developer platform is not available to that organization |
| `door_disabled` | The organization turned this way in **Off** |
| `client_blocked` | The organization blocked this app or assistant |
| `member_blocked` | The organization stopped this person from connecting this way |
| `private_app` | A private app used outside the organization that made it |
| `rejected` | An admin turned the connection down |
| `revoked_by_admin` | An admin removed the connection from that organization |
| `token_lifetime` | A personal token that lives longer than the organization allows |
| `sensitive_scopes_off` | The operation needs a sensitive scope and the organization switched sensitive access off (`details.scope`) |

A rejected or revoked organization can't be added back to the same connection by the person.

---
HTML version: https://beplan.io/docs/concepts/access/
