# Personal API tokens

> Create a personal access token to call the Sofia Space API from your own scripts or to connect AI tools, choose its scopes, call the API, and revoke it.

Source: https://docs.sofiaspace.uz/integrations/api-tokens/

A **personal API token** lets a script or tool act as you without signing in — like a GitHub personal access token. Use one to create tasks and pages from your own scripts, or to connect an AI tool such as Claude Code or Cursor.

**Who:** any member, for the current workspace. **Where:** **Settings → My account → Security → API tokens**.

:::tip[For a system, not a person]
A personal token acts as you and stops working when you leave the workspace. To connect a system such as an ERP or CRM for good, an Org Admin creates an [integration account](https://docs.sofiaspace.uz/integrations/integration-accounts.md) with its own tokens instead.
:::

## Create a token

1. Choose **Generate token**.
2. Give it a name that says what it's for.
3. Tick its scopes (below). Scopes your role doesn't allow are greyed out.
4. **Copy the token now.** It starts with `sophie_pat_` and is shown only once. Afterwards only its first characters are visible.

The list shows each token's scopes and when it was last used. Tokens don't expire on their own — revoke them when you no longer need them.

## Scopes

The **What can this token do?** list has two groups.

**For an AI app (MCP)** — the preset **Read and write tasks and docs** ticks the common ones:

| Scope | Shown as |
| --- | --- |
| `tasks:read` | **Read projects and tasks** |
| `tasks:write` | **Create and update tasks and comments** |
| `docs:read` | **Read docs pages** |
| `docs:write` | **Create and edit docs pages** |
| `projects:admin` | **Set up projects and boards** |
| `notifications:read` / `notifications:write` | **Read your notifications** / **Mark notifications read** |
| `calendar:read` / `calendar:write` | **Read your calendar** / **Create and answer calendar events** |
| `chat:read` / `chat:write` | **Read your chats** / **Send and edit messages as you** |
| `dashboards:read` / `dashboards:write` | **Read dashboards, reports and saved filters** / **Create, change and share dashboards, reports and saved filters** |
| `home:write` | **Change your Home widgets** |

**For scripts:** `task:create` (**Create tasks**) and `doc:create` (**Create docs**).

A token can never do more than your role allows; scopes your role doesn't allow show **not allowed for your role**. Guests can't get `projects:admin`, for example.

## Connect an AI app with a token

Use a token for AI tools that can't do the browser sign-in. After you create a token with AI scopes, **Connect an AI app** shows a ready command for Claude Code, like this:

```bash
claude mcp add --transport http sofia https://<your-workspace>.sofiaspace.uz/mcp --header "Authorization: Bearer sophie_pat_..."
```

Other apps take the same address and header. Things to know:

- The token's scopes decide which [MCP tools](https://docs.sofiaspace.uz/integrations/mcp-tools.md) work. An app can't ask for more; create a new token instead.
- Deleting and file download links aren't available with a token: the tools `delete_task`, `delete_comment`, `delete_attachment`, `delete_page` and `get_file_link` don't appear, and `edit_worklog` can change a worklog but not delete it. Use the browser sign-in for those, or do them in the app.
- The workspace's AI rules apply: if an admin turns off **AI agents**, or allows only approved AI apps and **API token** isn't approved, the token is refused for AI use. See [Approved AI apps](https://docs.sofiaspace.uz/admin/ai-app-policy.md).

## Call the API

Send the token in the `Authorization` header, on your workspace's own address:

```bash
curl https://<your-workspace>.sofiaspace.uz/api/v1/orgs/<org-id>/projects \
  -H "Authorization: Bearer sophie_pat_..."
```

Which endpoints a token can call depends on its scopes:

- **AI scopes** (`tasks:read`, `tasks:write`, `docs:read`, `docs:write`, `projects:admin`) reach the whole [API reference](https://docs.sofiaspace.uz/api/overview.md): projects, tasks, comments, page links, blockers, files, time, spaces, pages and search. Use them for any integration that reads data, even when no AI is involved.
- **Script scopes** reach only six endpoints:

| Scope | Endpoint | Does |
| --- | --- | --- |
| `task:create` | `GET /api/v1/orgs/{orgId}/task-types` | List task types (a task needs a `taskTypeId`) |
| `task:create` | `POST /api/v1/projects/{projectId}/tasks` | Create a task |
| `doc:create` | `POST /api/v1/spaces/{spaceId}/pages` | Create a page (`title`, optional `parentPageId`) |
| `doc:create` | `POST /api/v1/pages/{pageId}/publish` | Publish content into a page (add `?locale=uz` for a translation) |
| `doc:create` | `POST /api/v1/pages/{pageId}/locales` | Add a language version of a page |
| `doc:create` | `PUT /api/v1/pages/{pageId}/html` | Publish a new version of an existing [interactive HTML page](https://docs.sofiaspace.uz/api/spaces-and-pages.md#publish-a-new-version-of-an-interactive-html-page) (the HTML as the body) |

Your organization ID is shown next to your tokens, with a **Copy** button.

Notes:

- A new page has no content until you publish into it. Each publish creates a new version; nothing is overwritten.
- Publish content is the editor's own JSON document format, sent as a string — see [Rich text](https://docs.sofiaspace.uz/api/overview.md#rich-text).
- **Requests per minute:** a token with AI scopes gets 300 per person; a script-only token shares 600 a minute with the workspace's other script tokens, on every plan. See [Rate limits](https://docs.sofiaspace.uz/api/rate-limits.md).
- A token with AI scopes counts as an AI app: the workspace's AI rules apply to it (see [Approved AI apps](https://docs.sofiaspace.uz/admin/ai-app-policy.md)).

For every endpoint, its parameters and examples, see the [API reference](https://docs.sofiaspace.uz/api/overview.md) and its [OpenAPI file](https://docs.sofiaspace.uz/openapi.yaml.md).

## Revoke a token

Choose **Revoke** next to it. It stops working immediately. A token also stops working if you leave the workspace.

## What you can't do

- You can't see a token's full value again after creating it — generate a new one.
- You can't change a token's scopes; create a new token and revoke the old one.
- You can't use one token in several workspaces; each token belongs to the workspace it was created in.
- With the script scopes, you can't read, edit or delete anything — only the six endpoints above. For more, give the token AI scopes.
- Tokens don't expire on their own.

## Keep it secret

Treat a token like a password: don't commit it to a repository, paste it into a shared chat, or put it in website code. If one leaks, revoke it and create a new one.
