# API overview

> What the Sofia Space REST API is, the base address, the three kinds of API token (personal script tokens, personal full-access tokens and integration-account tokens), the request and response conventions, and a first call in three steps.

Source: https://docs.sofiaspace.uz/api/overview/

The Sofia Space REST API lets your own systems — a CRM, an ERP, a KPI dashboard, a nightly script — read and write tasks, projects, docs pages, comments and files in your workspace. Every call acts **as the owner of the API token**: either the person who created a [personal API token](https://docs.sofiaspace.uz/integrations/api-tokens.md), or an [integration account](https://docs.sofiaspace.uz/integrations/integration-accounts.md) — a workspace member that is a system, not a person. The token gets exactly its owner's permissions in that workspace. This section is written for the developers who connect those systems.

**Who can use it:** any workspace member, with a personal API token; Org Admins create integration accounts and their tokens. **Plans:** every plan, with the same request limits on every plan (see [Rate limits and size limits](https://docs.sofiaspace.uz/api/rate-limits.md)).

The machine-readable description of everything in this section is an OpenAPI 3.1 file: [`/openapi.yaml`](https://docs.sofiaspace.uz/openapi.yaml.md). You can import it into Postman, Insomnia or a code generator.

## Base address

Every call goes to **your workspace's own address**, followed by `/api/v1/...`:

```text
https://<workspace>.sofiaspace.uz/api/v1/...
```

For a workspace at `acme.sofiaspace.uz`, listing projects is `https://acme.sofiaspace.uz/api/v1/orgs/<orgId>/projects`. A token only works in the workspace it was created in; calling another workspace's address with it, or a path with another workspace's organization ID, is refused.

## Three kinds of token

Every token starts with `sophie_pat_` and is sent the same way. What differs is **who owns it** and **which scopes** it has; the scopes decide which endpoints it can call.

| | Personal token, script scopes | Personal token, AI scopes | Integration-account token |
| --- | --- | --- | --- |
| Created by | Any member, for themselves | Any member, for themselves | An Org Admin, in **Settings → Integrations** |
| Acts as | You | You | The integration account |
| Scopes | `task:create`, `doc:create` | `tasks:read`, `tasks:write`, `docs:read`, `docs:write`, `projects:admin` and others | The same full-access scopes as AI scopes, ticked under **Read** and **Write** |
| What it reaches | Five endpoints: create tasks, list task types, create and publish pages, add a page language | Every endpoint in this reference | Every endpoint in this reference |
| Can read data | Only the task-type list | Yes | Yes |
| Workspace AI rules apply | No | Yes — **AI agents** must be on, and **API token** must be an approved kind of AI app if the workspace limits them | No |
| Requests per minute | 600, shared by every member's script tokens in the workspace | 300 per person | 300 per integration account |
| Shown on what it writes | Nothing extra | "via" the token's name | The integration account's name, with an **Integration** badge |
| Stops working when | You revoke it, you leave the workspace, or your account is deleted | The same | It's revoked, its expiry date passes, or the account is deleted |

- For a script that only ever creates things and must not read anything, use the **script scopes**.
- For an integration that reads or changes data on **your** behalf, use a personal token with **AI scopes** — the name is historical; they're simply the full-access scopes.
- For a **system** — an ERP, a CRM, a KPI or payroll tool — use an [integration account](https://docs.sofiaspace.uz/integrations/integration-accounts.md). It keeps working when people leave, doesn't use a seat, and its role caps what it can do.

The endpoints made for other systems — create a task by project key, link a task to a record in another system, the KPI report — are on [Integrations API](https://docs.sofiaspace.uz/api/integrations.md). Any full-access token with the right scope can call them, personal or integration.

See [Authentication and scopes](https://docs.sofiaspace.uz/api/authentication.md) for every scope and what it unlocks.

## Conventions

- **JSON in, JSON out.** Send `Content-Type: application/json` with every request that has a body.
- **IDs are UUIDs**, for example `9d2e7a10-4b6c-4e8f-a1d3-5c7e9b2f4a68`. A task also has a human key such as `SALES-42` — the project key plus the task's `taskNumber`. [Look a task up by its key](https://docs.sofiaspace.uz/api/tasks.md#find-a-task-by-its-key-sales-42).
- **Times** are ISO 8601 in UTC, for example `2026-11-14T09:30:00Z`. **Dates** (due date, start date) are `yyyy-MM-dd`.
- **People** are referred to by their user ID (`assigneeId`, `authorId`, `createdBy`). Turn IDs into names with [`POST /api/v1/users/batch-get`](https://docs.sofiaspace.uz/api/me-and-workspace.md#turn-user-ids-into-names). An integration account is a user too: it comes back with `"integration": true`.
- **Rich text** — task descriptions, comments and page content — is the editor's document format (JSON) sent **as a string**. Plain text also works for descriptions and comments: it shows as plain paragraphs. See [Rich text](#rich-text).
- **Absent and `null` fields** mean "not set". On updates, a field you leave out is not changed.
- **Errors** have one JSON shape with a stable `code`. See [Errors](https://docs.sofiaspace.uz/api/errors.md).
- **Lists** either come whole or a page at a time with a cursor. See [Pagination](https://docs.sofiaspace.uz/api/pagination.md).
- **Creates can be made safe to retry** with an `Idempotency-Key` header. See [Idempotency and retries](https://docs.sofiaspace.uz/api/idempotency.md).

## Your first call in three steps

1. Create a token with **Read projects and tasks** ticked: **Settings → My account → Security → API tokens → Generate token** ([how](https://docs.sofiaspace.uz/integrations/api-tokens.md)). Copy it — it starts with `sophie_pat_` and is shown once. (For a system, an Org Admin creates an integration-account token instead: [how](https://docs.sofiaspace.uz/integrations/integration-accounts.md#give-the-system-a-token).)
2. Find your workspace's organization ID. It is shown next to your tokens with a **Copy** button, or ask the API:

   ```bash
   curl https://acme.sofiaspace.uz/api/v1/orgs/by-subdomain/acme \
     -H "Authorization: Bearer $SOFIA_TOKEN"
   ```

   The answer's `organization.id` is your organization ID, and `userId` is the token owner's user ID.
3. List the projects you can see:

   ```bash
   curl https://acme.sofiaspace.uz/api/v1/orgs/6b1f0c3e-2a4d-4c55-9a51-0d3f6a1e7b20/projects \
     -H "Authorization: Bearer $SOFIA_TOKEN"
   ```

   ```json
   {
     "projects": [
       {
         "id": "9d2e7a10-4b6c-4e8f-a1d3-5c7e9b2f4a68",
         "orgId": "6b1f0c3e-2a4d-4c55-9a51-0d3f6a1e7b20",
         "key": "SALES",
         "name": "Sales pipeline",
         "visibility": "MEMBERS",
         "canManage": true
       }
     ]
   }
   ```

   (Responses in these pages are shortened to the fields that matter; the full field list is in each resource page and in the OpenAPI file.)

From here, [create a task](https://docs.sofiaspace.uz/api/tasks.md#create-a-task) or follow a complete example in [Integration examples](https://docs.sofiaspace.uz/api/examples.md).

## Rich text

Descriptions, comments and pages are stored as an editor document: a JSON object with `"type": "doc"` and a list of blocks, sent as a **string** inside your JSON body. The smallest document with one paragraph is:

```json
{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Quote sent to the customer."}]}]}
```

So a comment body looks like this (note the escaped quotes — the document is a string):

```json
{ "content": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Quote sent to the customer.\"}]}]}" }
```

Common blocks: `paragraph`, `heading` (with `"attrs": {"level": 2}`), `bulletList` / `orderedList` containing `listItem`s, `codeBlock`, and text `marks` such as `bold`, `italic` and `link` (`{"type":"link","attrs":{"href":"https://..."}}`).

- **Task descriptions and comments** also accept plain text: `"description": "Customer asked for a quote."` shows as one paragraph per line.
- **Page content** must be a document like the one above; [publish](https://docs.sofiaspace.uz/api/spaces-and-pages.md#publish-content-into-a-page) sends it.
- Responses return the same string. Parse it with any JSON parser; a value that isn't JSON is plain text.

## What the API can't do yet

- This reference doesn't cover chat, calendar, notifications or dashboards (apart from the [KPI report](https://docs.sofiaspace.uz/api/integrations.md)). Tokens with those scopes work through the [MCP connection](https://docs.sofiaspace.uz/integrations/mcp-tools.md) used by AI apps. Drive can't be reached with a token at all.
- You can't delete tasks, comments, worklogs, attachments or pages with a token, and you can't download attachments (you can list them): these answer `403 SIGNED_IN_APP_ONLY`. See [Actions only signed-in apps can do](https://docs.sofiaspace.uz/api/authentication.md#actions-only-signed-in-apps-can-do).
- Webhooks are set up by an Org Admin in **Settings → Integrations**, not through the API. To react to changes, use a [webhook](https://docs.sofiaspace.uz/integrations/webhooks.md), or poll — for example [list tasks updated since yesterday](https://docs.sofiaspace.uz/api/tasks.md#list-tasks-in-a-project).
- You can't manage members, roles, billing, integration accounts or tokens through the API.
- A token can't act for anyone else: everything it does is done as its owner.

## Related

- [Authentication and scopes](https://docs.sofiaspace.uz/api/authentication.md)
- [Errors](https://docs.sofiaspace.uz/api/errors.md)
- [Integration examples](https://docs.sofiaspace.uz/api/examples.md)
- [Integrations API](https://docs.sofiaspace.uz/api/integrations.md)
- [Personal API tokens](https://docs.sofiaspace.uz/integrations/api-tokens.md)
- [Integration accounts](https://docs.sofiaspace.uz/integrations/integration-accounts.md)
