API authentication and API keys
Every OmniSocials API request requires a Bearer token in the Authorization header. Tokens are long-lived API keys created from the dashboard.
Text
Create an API key
- Sign in to app.omnisocials.com
- Open Settings → API
- Click Create API Key
- Name the key (e.g. "Zapier", "Internal automation"), pick the scopes it needs, and save
- Copy the key and store it somewhere safe. Members who can manage the organisation's API can copy it again later from the key list under Settings → API
Every key starts with omsk_live_ and works on your real, connected social accounts. There is no separate test environment or test key, so point CI and local development at a workspace whose accounts you can post to safely, or create drafts (they never publish on their own).
Scopes
Every key is scoped to a subset of the API. A key only has access to the scopes you selected when you created it.
| Scope | Grants access to |
|---|---|
posts:read | GET /posts, GET /posts/:id |
posts:write | POST /posts/create, PATCH /posts/:id, DELETE /posts/:id, publish endpoints |
media:read | GET /media, GET /media/:id, GET /folders, POST /media/check |
media:write | POST /media/upload, POST /media/upload-from-url, PATCH /media/:id, DELETE /media/:id |
accounts:read | GET /accounts, GET /accounts/:id |
analytics:read | GET /analytics/* endpoints, GET /posts/recent-platform. The overview, account numbers, tag comparison, Update now and GET /posts/recent-platform also need the View analytics permission (access_analytics) for the person who created the key, as the Analytics pages in OmniSocials (Analytics) |
webhooks:manage | Full CRUD on webhooks, including secret rotation |
inbox:read | Opt-in. GET /inbox/*: conversations, messages, and the next unanswered item |
inbox:write | Opt-in. Replies, marking read, hiding and deleting comments |
automations:read | Opt-in. GET /automations, GET /automations/:id, and the activity log |
automations:write | Opt-in. Create, update, and delete automations, and comment_dm_automation on posts |
accounts:write | Opt-in, the Credits and X statistics switch. PATCH /accounts/:id: how often an X account's statistics are read, which changes what it costs in credits (X statistics). The key's creator needs billing rights (manage_billing) |
credits:read | Opt-in, the same Credits and X statistics switch. GET /credits: the credit balance and the X statistics use. The key's creator needs billing rights (manage_billing) |
The first seven scopes are the default set. The inbox, automation and credits scopes are opt-in: turn on Social Inbox access, Automations or Credits and X statistics (accounts:write and credits:read) when you create the key. Existing keys never get them automatically.
Requests made with a key missing the required scope return 403 Forbidden with the code insufficient_scope. The message names the missing scope and, for an opt-in scope, the switch that adds it:
JSON
Add the missing scope by creating a new key, not by editing an existing one.
API metadata
The scopes are machine-readable too. In the OpenAPI document, every operation names the scope it needs in x-required-scopes (an empty list means any valid key), and x-scopes on the bearerAuth security scheme describes every scope and says which are opt-in.
The API also publishes its RFC 9728 protected resource metadata at https://api.omnisocials.com/.well-known/oauth-protected-resource/v1: the resource https://api.omnisocials.com/v1, the scopes a key can hold, and that the key goes in the Authorization header. Every 401 points there:
Text
error="invalid_token" is there when a key was sent and refused; without an Authorization: Bearer header it is left out. A 403 insufficient_scope carries error="insufficient_scope" and the missing scope, for example scope="posts:write". On https://api.omnisocials.com/v1 the REST API takes API keys only, so its metadata names no authorization server (see OAuth 2.0 below).
OAuth 2.0 (beta)
OAuth access tokens on the REST API are in beta and work only where they are switched on: today that is the OmniSocials staging servers, for testing. On https://api.omnisocials.com/v1 the API takes API keys only, and the steps below do not work there yet. API keys keep working everywhere.
Where it is switched on, an app can call the API for a person with an OAuth 2.0 access token instead of an API key. The person allows the app on the OmniSocials consent page; nobody copies a key.
- Discover. The API metadata at
/.well-known/oauth-protected-resource/v1of the API host you call names the resource (resource) and the authorization server (authorization_servers). The authorization server's metadata (/.well-known/oauth-authorization-serveron that server) lists the authorization, token, registration and revocation endpoints and the API scopes inscopes_supported. - Register the app with dynamic client registration (RFC 7591), or reuse a client you registered before.
- Authorize with the authorization code flow and PKCE (S256 only). Send the
resourceof the host you call (RFC 8707):https://stagingapi.omnisocials.com/v1on staging, andhttps://api.omnisocials.com/v1on production once OAuth is on there. A token works only on the host of its resource. Send the scopes you need inscope, space separated. Withoutscopethe app asks for the default set of a key. - Consent. The person signs in, picks the workspaces the app may reach, reads each scope in plain words and switches on the opt-in scopes (inbox, automations, credits and X statistics) they allow. A
:writescope also gives its:readscope, as for a key: the page shows the read scope as included, and the token holds both. As for an API key, their role must allow API access (manage_api) and each scope in every workspace they pick. - Token. Exchange the code at the token endpoint with the
code_verifierand the sameresourceas in step 3. The answer holdsaccess_token(valid 1 hour),refresh_token,scope(what the person allowed) andworkspace_ids(the workspaces the token reaches).
Call the API with the token as a Bearer token:
Text
X-Workspace-Id picks one of the token's workspaces. Without it the call goes to the lowest id in workspace_ids, and never to another workspace: when the person loses that workspace, the call is refused. Every call checks the person's role again, so a token never does more than the person may do in OmniSocials.
| Answer | When |
|---|---|
401 invalid_token | The token is unknown, expired or revoked, or it was made for another resource (for example an MCP connection to mcp.omnisocials.com) |
403 insufficient_scope | The token lacks the scope; WWW-Authenticate names it, as for a key |
403 insufficient_permission | The person's role no longer allows the action or API access |
403 workspace_not_allowed | X-Workspace-Id is not one of the token's workspaces, or the person can no longer open it |
A refresh (grant_type=refresh_token) may ask for fewer scopes, never for more (400 invalid_scope), and keeps the resource of the authorization (400 invalid_target for another one). The person ends the app's access in Settings → Integrations, where it shows as API access; the app can also call the revocation endpoint.
When a key stops working
A key acts as the person who created it, in the workspace it was made for. Every request checks that this person still belongs to the workspace and still holds Manage API keys (manage_api) in the organisation that owns the workspace. When an admin removes the person, or takes Manage API keys off their role, the key stops at the next request with 401 invalid_api_key, the same answer as a revoked key. Give the permission back and the same key works again. Owners and admins hold every permission, so their keys are not affected. The other permissions of the role are checked per request too: an action the role no longer allows answers 403 insufficient_permission.
Rotating and revoking keys
Revoke a key from Settings → API at any time. Revocation is immediate. In-flight requests using a revoked key fail with 401 Unauthorized on the next call.
To rotate a key without downtime, create the new key first, update your integration, and only then revoke the old key. A webhook belongs to the key that made it (or last changed its URL or events, or switched it on), and revoking that key switches the webhook off. Before you revoke the old key, move each webhook to the new key: PATCH /webhooks/{id} with {"is_active": true}, sent with the new key. This applies to keys revoked, deleted or expired from 2026-11-26 on: webhooks of keys revoked before that date keep working.
Security notes
- Never commit API keys to source control. Load them from environment variables or a secrets manager.
- Give the keys you use in local development and CI only the scopes they need, and revoke them when a project ends.
- A compromised key can do anything its scopes allow. Scope keys narrowly.
- Tokens do not expire automatically. Rotate them periodically as a hygiene practice.