Authentication and scopes
Every Sofia Space API call is authenticated with an API token sent in the Authorization header. A token belongs to one owner in one workspace: either you (a personal API token) or an integration account (a member that is a system, such as your ERP). Its scopes decide which endpoints it may call; its owner’s role in the workspace decides what those calls may touch.
Who can create a token:
- Personal API token: any workspace member, for themselves, in Settings → My account → Security → API tokens. Step-by-step instructions, with a screenshot, are on Personal API tokens.
- Integration-account token: Org Admins, in Settings → Integrations, for an integration account. See Integration accounts.
Send the token
Section titled “Send the token”Put the token after Bearer in the Authorization header of every request:
curl https://acme.sofiaspace.uz/api/v1/agent/scopes \ -H "Authorization: Bearer sophie_pat_3kQ9...your-token..."- Both kinds of token start with
sophie_pat_. Anything else in that header is treated as a sign-in session, not a token. - Use your workspace’s address (
https://<workspace>.sofiaspace.uz). A token used on another workspace’s address, or on a path naming another workspace’s organization ID, is refused with403. - Personal tokens created in the app don’t expire. They stop working when you revoke them, when you leave the workspace, or when your account is deleted.
- Integration-account tokens can have an expiry date (Expires on). They stop working when it passes, when an Org Admin revokes them, or when the account is deleted.
- Keep tokens on your server. Never put one in website or mobile-app code, a repository, or a shared chat.
Check what a token can do
Section titled “Check what a token can do”GET /api/v1/agent/scopes answers which scopes this token may use right now — its scopes, capped by its owner’s current role — and the owner’s user ID. It needs any scope except the two script scopes.
curl https://acme.sofiaspace.uz/api/v1/agent/scopes \ -H "Authorization: Bearer $SOFIA_TOKEN"{ "scopes": ["docs:read", "docs:write", "tasks:read", "tasks:write"], "roleScopes": ["calendar:read", "chat:read", "dashboards:read", "dashboards:write", "docs:read", "docs:write", "projects:admin", "tasks:read", "tasks:write"], "userId": "2c9a7f41-5b3e-4d1a-8f20-7e6b5c4d3a21"}scopesis what this token can use now, sorted.roleScopesis the most any personal token of yours could get with your current role. It is left out for an integration-account token, and when it can’t be worked out.userIdis your user ID — or, for an integration-account token, the account’s user ID.
A token with only script scopes gets 403 here (“This token does not have the Sofia Space AI scope”).
Scopes
Section titled “Scopes”Tick scopes when you create the token. You can’t change them later — create a new token instead.
Script scopes
Section titled “Script scopes”The two For scripts scopes reach only six endpoints. Use them for a script that only ever creates things and must not be able to read anything. They are offered for personal tokens only.
| Scope | Shown as | Endpoints |
|---|---|---|
task:create |
Create tasks | GET /api/v1/orgs/{orgId}/task-types, POST /api/v1/projects/{projectId}/tasks |
doc:create |
Create docs | POST /api/v1/spaces/{spaceId}/pages, POST /api/v1/pages/{pageId}/publish, POST /api/v1/pages/{pageId}/locales, PUT /api/v1/pages/{pageId}/html (a new version of an interactive HTML page) |
On these six endpoints a script scope always wins, even if the token also has AI scopes: the workspace’s AI rules don’t apply to the call, nothing is marked “via” the token, and it counts against the workspace-wide script allowance (see Rate limits).
Full-access scopes (AI scopes)
Section titled “Full-access scopes (AI scopes)”The For an AI app (MCP) scopes are the full-access scopes. They are what you want for any integration that reads data, even if no AI is involved. Integration-account tokens use the same scopes, ticked under Read and Write. The ones this reference uses:
| Scope | Shown as | Lets the token |
|---|---|---|
tasks:read |
Read projects and tasks | List and read projects, statuses, task types, labels, sprints, custom fields, tasks, comments, activity history, page links, an epic’s outside blockers, attachments (list only), time, your running timer and linked records; search |
tasks:write |
Create and update tasks and comments | Create and update tasks (also by project key), move them through the workflow, reorder the backlog, comment, link pages and records in other systems, add blockers, labels and field values, log and edit work, run your timer, upload and attach files |
docs:read |
Read docs pages | List and read spaces, pages, page content, comments, attachments (list only) and backlinks; search |
docs:write |
Create and edit docs pages | Create spaces and pages, publish content (also new versions of interactive HTML pages), rename and move pages, comment, upload and attach files |
projects:admin |
Set up projects and boards | Create projects, add and change workflow statuses and transitions, create task types, create, start and complete sprints |
dashboards:read |
Read dashboards, reports and saved filters | Read the KPI report; also look up your workspace and turn user IDs into names |
Other full-access scopes (notifications:*, calendar:*, chat:*, dashboards:write, home:write) are used by AI apps through the MCP connection; their endpoints aren’t documented here yet.
The preset Read and write tasks and docs ticks tasks:read, tasks:write, docs:read and docs:write.
Which scope each endpoint needs
Section titled “Which scope each endpoint needs”Each endpoint in this reference states its scope. Where several are listed, any one of them is enough.
| Area | Read | Write |
|---|---|---|
| You and your workspace | tasks:read or docs:read |
— |
| Projects and workflow | tasks:read |
projects:admin (labels: tasks:write) |
| Tasks, comments, links and blockers | tasks:read |
tasks:write (creating a task: also task:create) |
| Time tracking | tasks:read |
tasks:write |
| Files and attachments | tasks:read / docs:read |
tasks:write or docs:write |
| Spaces and pages | docs:read |
docs:write (creating and publishing: also doc:create) |
| Search | tasks:read or docs:read |
— |
| Integrations API | tasks:read; KPI report: dashboards:read |
tasks:write |
The owner’s role caps every token
Section titled “The owner’s role caps every token”A token can never do more than its owner can in the app:
- The scopes you can tick depend on the owner’s role. For a personal token, ones your role doesn’t allow are shown as not allowed for your role; for an integration account, its role sets the most a token can get. A guest can’t get
projects:admin; a guest getstasks:writeordocs:writeonly through a project or space role that can do more than view. - The cap is checked on every call. If the owner’s role changes, the token loses what the new role doesn’t allow on its next call — usually
403 INSUFFICIENT_SCOPE. - Normal permissions still apply. A token with
tasks:writestill can’t change a project its owner can only view, or a task in a project they’re not in.projects:admindoesn’t let anyone create projects who can’t in the app: only Org Admins and roles allowed to create projects can (otherwise403 PROJECT_CREATE_NOT_ALLOWED). - If the workspace is archived, or the owner’s account is restricted, the token loses its write scopes: write calls are refused with
403; reads keep working.
Workspace rules that apply to personal AI-scope tokens
Section titled “Workspace rules that apply to personal AI-scope tokens”A personal token with any AI scope counts as an AI app called API token. An Org Admin controls these in Settings → AI apps (see Approved AI apps):
| Workspace setting | Effect on the token | Error |
|---|---|---|
| AI agents switched off (Settings → Advanced → Modules) | Every call refused | 403 MCP_DISABLED |
| Only approved AI apps, and API token not ticked | Every call refused | 403 AI_APP_NOT_APPROVED |
| An admin turned off this token for you | Every call refused | 403 AI_APP_BLOCKED |
Admins see the token in Settings → AI apps under its name, with when it was first and last used. Things it writes are marked as done “via” the token’s name.
These settings don’t affect:
- Script-scope tokens (
task:create,doc:create). - Integration-account tokens. A system isn’t an AI app: switching AI agents off doesn’t cut off your ERP. The integration account’s role, its project and space memberships and the token’s scopes still apply. What it writes shows the account’s name, not “via”.
Refusals you’ll see
Section titled “Refusals you’ll see”| Status | error / code |
Why | What to do |
|---|---|---|---|
401 |
code: UNAUTHENTICATED, “Invalid, expired, or revoked API token” |
The token is wrong, revoked or expired, or its owner left the workspace | Check the header; create a new token |
403 |
code: PERMISSION_DENIED, “Personal API tokens cannot be used for this endpoint” |
The endpoint isn’t open to tokens at all (this applies to integration-account tokens too) | Use only endpoints from this reference |
403 |
code: PERMISSION_DENIED, “This token does not have the … scope” |
A script-scope token on an endpoint that needs a full-access scope, or a token without task:create / doc:create on a script endpoint. Also a script token while the workspace is archived or the account restricted |
Create a token with the right scope |
403 |
code: PERMISSION_DENIED, “This token belongs to a different organization” |
Wrong workspace address, subdomain or organization ID | Call your own workspace |
403 |
error: INSUFFICIENT_SCOPE, with acceptedScopes |
A full-access token missing the scope this endpoint needs — including one the owner’s role no longer allows | Create a token with one of acceptedScopes, or ask an admin about the role |
403 |
error: ROLE_NOT_ALLOWED, with acceptedScopes |
The owner’s role doesn’t allow that scope here (rare: most role changes show as INSUFFICIENT_SCOPE) |
Ask an admin about the role |
403 |
error: NOT_AVAILABLE_TO_AGENTS |
The endpoint isn’t open to full-access tokens — for example adding a page language, which only doc:create reaches |
Use a token with the scope the endpoint lists |
403 |
error: SIGNED_IN_APP_ONLY, “This action needs an app you signed in to; API tokens can’t do it” |
The action is for apps you signed in to only (see below). No scope changes this | Do it in the app, or from an AI app signed in through the MCP server |
403 |
error: MCP_DISABLED, AI_APP_NOT_APPROVED, AI_APP_BLOCKED |
A workspace AI rule (personal AI-scope tokens only, see above) | Ask an Org Admin |
All error shapes are on Errors.
Actions only signed-in apps can do
Section titled “Actions only signed-in apps can do”Deleting, and links that hand out a file’s bytes, need a person who signed in — in the app, or in an AI app connected through the Sofia Space MCP server with the browser sign-in. An API token (personal or integration-account) gets 403 on these, whatever its scopes:
{ "error": "SIGNED_IN_APP_ONLY", "message": "This action needs an app you signed in to; API tokens can't do it" }| Endpoint | What it does |
|---|---|
DELETE /api/v1/tasks/{taskId} |
Delete a task (archive it instead) |
DELETE /api/v1/task-comments/{commentId} |
Delete a task comment |
DELETE /api/v1/worklogs/{worklogId} |
Delete a worklog (edit it instead) |
DELETE /api/v1/tasks/{taskId}/attachments/{attachmentId} |
Remove a task attachment |
GET /api/v1/tasks/{taskId}/attachments/{fileId}/download-url |
Download link for a task attachment |
DELETE /api/v1/pages/{pageId} |
Delete a page |
DELETE /api/v1/comments/{commentId} |
Delete a page comment |
DELETE /api/v1/pages/{pageId}/attachments/{attachmentId} |
Remove a page attachment |
GET /api/v1/pages/{pageId}/attachments/{fileId}/download-url |
Download link for a page attachment |
What you can’t do
Section titled “What you can’t do”- You can’t use a username and password, OAuth client credentials or a service account with the API — only API tokens. For a system, use an integration account rather than a person’s token, so it keeps working when people leave.
- You can’t see a token’s full value again, change its scopes, or move it to another workspace.
- You can’t create or revoke tokens, or manage integration accounts, members, roles or billing, through the API — not even with an integration-account token.
- You can’t set an expiry date on a personal token in the app.
Related
Section titled “Related”- Personal API tokens — creating and revoking personal tokens
- Integration accounts — accounts and tokens for other systems
- Integrations API
- Approved AI apps — the admin settings above
- Errors