> Documentation index: https://docs.zernio.com/llms.txt. Every page is also Markdown: add .md to its URL.

# OAuth scopes

Every scope a Zernio OAuth app can ask for, what each one reaches, and how a user narrows them on the consent screen.

Ask for the least your app needs. The user can lower any of it on the consent screen, so read the granted `scope` from the token response.

## Request scopes

Put them in the `scope` parameter of the authorize URL, separated by spaces. A client may only ask for scopes it registered. Without `scope`, it gets every scope it registered.

Registering a write scope also lets the client ask for the matching read scope.

## Resource scopes

| Scope | Gives the app | Consent area |
|---|---|---|
| `posts:read` | Read scheduled and published posts | Posts |
| `posts:write` | Create, schedule, edit and delete posts | Posts |
| `accounts:read` | Read connected accounts, profiles and usage | Accounts and profiles |
| `accounts:write` | Connect and disconnect social accounts | Accounts and profiles |
| `analytics:read` | Read post and ad performance | Analytics |
| `messaging:read` | Read the inbox, mailboxes, comments, reviews, call and SMS history | Inbox and messages |
| `messaging:write` | Also send messages, emails, replies and broadcasts | Inbox and messages |
| `automations:read` | Read contacts, CRM records, leads, webhooks and delivery logs | Contacts and webhooks |
| `automations:write` | Also create and edit contacts, CRM records, leads, SMS opt-outs and webhooks | Contacts and webhooks |
| `contacts:read` | Older read scope for contacts. Prefer `automations:read` | Contacts and webhooks |
| `ads:read` | Read ad accounts, campaigns, audiences and results | Ads |
| `ads:write` | Also create, edit and run campaigns. Can spend ad budget | Ads |
| `commerce:read` | Read orders, returns, products and promotions | Shop |
| `commerce:write` | Also fulfil orders, refund, and manage catalog and promotions | Shop |
| `calendar:read` | Read events and availability | Calendars |
| `calendar:write` | Also create, edit and RSVP to events | Calendars |
| `files:read` | List and download Google Drive and OneDrive files | Files |
| `files:write` | Also upload and share files | Files |
| `campaigns:read` | Read creator campaigns, creators, posts and payouts | Creator campaigns |
| `campaigns:write` | Also run campaigns and record payouts | Creator campaigns |
| `money:read` | Read the balance, ledger, transfers and payees | Balance and payouts |
| `money:write` | Also add funds and transfer money | Balance and payouts |

## Identity scope

| Scope | Gives the app |
|---|---|
| `email` | The user's email address and whether it is verified, from `/api/oauth/userinfo` |

`email` is left out when you register without `scope`. Register it by name to use it. Without it, userinfo returns `sub`, `name` and `picture` only.

If your authorize URL leaves out `scope`, you ask for every scope you registered, `email` included. The user cannot turn `email` off on the consent screen.

## Which endpoints a scope reaches

Every operation in the [API reference](/posts/list-posts) lists the scopes that reach it in `x-oauth-scopes`, in the [OpenAPI spec](https://zernio.com/openapi.yaml). Any one of them is enough.

Reads need the read scope or the write scope. Writes need the write scope.

## How it behaves

- A request outside the grant answers `403` with `WWW-Authenticate: Bearer error="insufficient_scope", scope="..."`. The `scope` value is the grant plus the one scope that would allow it.
- To get more access, send the user through the authorize URL again with the bigger `scope`.
- A refresh can narrow the scope with `scope=...`, never widen it.
- `accounts:read` also covers the usage and billing endpoints.
- `analytics:read` covers the whole analytics area, including its few writes, such as tracking setup. There is no `analytics:write`.
- No scope reaches API keys, invites, connected apps, workspace members, SSO or account deletion.

## Related

- [Consent screen](/oauth/consent-screen)
- [Errors](/oauth/errors)
- [Quickstart](/oauth/quickstart)