# Tasks (API)

> API endpoints to list, find, read, create and update tasks, move them through the workflow, archive them, nest them under a parent or epic, move them to a sprint, reorder the backlog, and set labels and custom-field values.

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

A **task** is one piece of work in a project, with a key such as `SALES-42`. These endpoints are what most integrations use: a CRM creates a task when a deal is won, an ERP moves it to **Done** when the invoice is paid, a KPI script lists what was finished this week. Comments, page links, blockers, files and time have their own pages (see [Related](#related)).

**Scope:** reading needs `tasks:read`; every change needs `tasks:write`. Creating a task also works with the script scope `task:create`. Project permissions still apply: you can only change tasks in projects where your role allows it.

Connecting another system (a CRM, an ERP)? The [Integrations API](https://docs.sofiaspace.uz/api/integrations.md) adds a create by project key and names, links between a task and a record in that system, and a KPI export.

Examples use the project `SALES` (`9d2e7a10-4b6c-4e8f-a1d3-5c7e9b2f4a68`) in `acme.sofiaspace.uz`.

## The task object

```json
{
  "id": "7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20",
  "projectId": "9d2e7a10-4b6c-4e8f-a1d3-5c7e9b2f4a68",
  "taskNumber": 42,
  "taskTypeId": "1a3c5e7f-9b2d-4f6a-8c1e-3d5f7a9b2c4e",
  "parentTaskId": null,
  "statusId": "5a2b3c4d-6e7f-4a81-9b0c-1d2e3f4a5b61",
  "title": "Onboard new customer (deal #1042)",
  "description": "Contract signed on 12 November. Set up the account and train two users.",
  "assigneeId": "8e4d2b19-6c7a-4f3e-b1d0-3a5c9e8f7d62",
  "reporterId": "2c9a7f41-5b3e-4d1a-8f20-7e6b5c4d3a21",
  "labelIds": ["b6c7d8e9-0a1b-4c2d-8e3f-4a5b6c7d8e9f"],
  "createdAt": "2026-11-12T09:15:00Z",
  "updatedAt": "2026-11-13T14:02:11Z",
  "startedAt": "2026-11-13T10:40:27Z",
  "completedAt": null,
  "blocks": [],
  "blockedBy": [],
  "priority": "HIGH",
  "storyPoints": 3,
  "dueDate": "2026-11-20",
  "rank": 1048576,
  "sprintId": null,
  "epicId": null,
  "fieldValues": [ { "fieldId": "f1e2d3c4-b5a6-4978-8a9b-0c1d2e3f4a5b", "text": null, "number": "125000000", "date": null, "checked": null, "optionId": null, "optionIds": null, "userIds": null } ],
  "startDate": "2026-11-13",
  "archivedAt": null,
  "teamId": null,
  "componentId": null,
  "initiativeId": null,
  "archivedBy": null,
  "hiddenOpenBlockers": 0,
  "hiddenBlocks": 0,
  "externalRefs": [
    { "system": "crm", "id": "1042", "url": "https://crm.example.uz/deals/1042", "label": "Deal #1042", "createdBy": "2c9a7f41-5b3e-4d1a-8f20-7e6b5c4d3a21", "createdAt": "2026-11-12T09:15:00Z" }
  ]
}
```

| Field | Meaning |
| --- | --- |
| `taskNumber` | With the project key, the task's key: `SALES-42` |
| `statusId` | The current [status](https://docs.sofiaspace.uz/api/projects.md#list-a-projects-statuses) |
| `description` | Rich text as a string, or plain text (see [Rich text](https://docs.sofiaspace.uz/api/overview.md#rich-text)); `null` when empty |
| `priority` | `HIGHEST`, `HIGH`, `MEDIUM`, `LOW` or `LOWEST` |
| `dueDate`, `startDate` | `yyyy-MM-dd` |
| `startedAt` | When the task first left a to-do status; `null` if it never has |
| `completedAt` | When the task last moved into a done status; `null` while it isn't done (reopening clears it). With `startedAt` or `createdAt` it gives the time to complete |
| `rank` | Order in the backlog (lower comes first) |
| `blocks`, `blockedBy` | Tasks this one blocks / is blocked by — see [Blockers](https://docs.sofiaspace.uz/api/task-comments-links-blockers.md#blockers) |
| `hiddenOpenBlockers`, `hiddenBlocks` | Blockers in projects you can't open: counted, never named |
| `fieldValues` | Custom-field values; exactly one value member is set per field (see [Set custom-field values](#set-custom-field-values)) |
| `archivedAt` | Set when the task is archived |
| `externalRefs` | Records in other systems this task stands for — see [Link a task to a record](https://docs.sofiaspace.uz/api/integrations.md#link-a-task-to-a-record-in-your-system). Filled when you get, create or look up one task; always empty in lists |

The task object has no project key and no status name: get them from [the project](https://docs.sofiaspace.uz/api/projects.md#get-a-project) and [its statuses](https://docs.sofiaspace.uz/api/projects.md#list-a-projects-statuses), and cache them.

## List tasks in a project

`GET /api/v1/projects/{projectId}/tasks` — **Scope:** `tasks:read`. [Paged](https://docs.sofiaspace.uz/api/pagination.md): `items`, `nextCursor`, `hasMore`; up to 100 per page.

| Parameter | Meaning |
| --- | --- |
| `assigneeId`, `reporterId`, `statusId`, `taskTypeId`, `parentTaskId`, `sprintId`, `epicId` | Only tasks with this value |
| `labelIds` | Only tasks with these labels (repeat the parameter for several) |
| `archived` | `exclude` (default), `only` or `include` |
| `createdFrom`, `createdTo` | Created in this date range, `yyyy-MM-dd`, inclusive |
| `updatedFrom`, `updatedTo` | Changed in any way (a field, status, assignee, comment, file or link) in this range |
| `doneFrom`, `doneTo` | Moved to a done status in this range and still done |
| `tz` | Time zone the date ranges are counted in, for example `Asia/Tashkent`; default UTC |
| `sort` | `number` (default, by task number), `rank` (backlog order) or `field` (by a custom field, with `sortFieldId`) |
| `sortFieldId`, `sortDirection` | For `sort=field`: the field, and `asc` or `desc` |
| `fieldFilters` | Custom-field conditions as a JSON array, for example `[{"fieldId":"…","op":"GTE","values":["100000000"]}]` |
| `description` | `false` leaves descriptions out — much faster for big lists |
| `limit`, `cursor` | [Paging](https://docs.sofiaspace.uz/api/pagination.md) |

Example — tasks finished this week in Tashkent time, for a KPI report:

```bash
curl -G https://acme.sofiaspace.uz/api/v1/projects/9d2e7a10-4b6c-4e8f-a1d3-5c7e9b2f4a68/tasks \
  -H "Authorization: Bearer $SOFIA_TOKEN" \
  --data-urlencode "doneFrom=2026-11-09" \
  --data-urlencode "doneTo=2026-11-15" \
  --data-urlencode "tz=Asia/Tashkent" \
  --data-urlencode "description=false" \
  --data-urlencode "limit=100"
```

```json
{
  "items": [
    { "id": "7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20", "taskNumber": 42, "title": "Onboard new customer (deal #1042)", "statusId": "6b3c4d5e-7f80-4b92-8c1d-2e3f4a5b6c72", "assigneeId": "8e4d2b19-6c7a-4f3e-b1d0-3a5c9e8f7d62", "description": null }
  ],
  "nextCursor": null,
  "hasMore": false
}
```

`fieldFilters` operators: `IS_SET`, `IS_EMPTY` (any field); `EQUALS`, `CONTAINS` (text, URL); `EQ`, `NE`, `LT`, `LTE`, `GT`, `GTE` (number, money, progress); `BETWEEN` (number or date, two values); `ON`, `BEFORE` and more for dates. Values are strings in the field's format. For a people field, `"me"` means you.

## Get a task

`GET /api/v1/tasks/{taskId}` — **Scope:** `tasks:read`. Returns [the task object](#the-task-object).

```bash
curl https://acme.sofiaspace.uz/api/v1/tasks/7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20 \
  -H "Authorization: Bearer $SOFIA_TOKEN"
```

## Find a task by its key (SALES-42)

`GET /api/v1/projects/by-key/{projectKey}/tasks/{taskNumber}/summary` — **Scope:** `tasks:read`.

People write task keys in e-mails and CRM notes. Turn `SALES-42` into the task's ID:

```bash
curl https://acme.sofiaspace.uz/api/v1/projects/by-key/SALES/tasks/42/summary \
  -H "Authorization: Bearer $SOFIA_TOKEN"
```

```json
{
  "id": "7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20",
  "taskNumber": 42,
  "title": "Onboard new customer (deal #1042)",
  "statusId": "5a2b3c4d-6e7f-4a81-9b0c-1d2e3f4a5b61",
  "projectId": null,
  "projectKey": null,
  "done": false,
  "statusName": null
}
```

Then use the `id` with the other endpoints. `404` if there's no such task or you can't open it.

## Create a task

`POST /api/v1/projects/{projectId}/tasks` — **Scope:** `tasks:write` or `task:create`. Honours [`Idempotency-Key`](https://docs.sofiaspace.uz/api/idempotency.md). Returns `201` and the task.

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `taskTypeId` | string | yes | From [task types](https://docs.sofiaspace.uz/api/projects.md#list-task-types) |
| `title` | string | yes | Up to 500 characters |
| `description` | string | no | Plain text or a rich-text document string |
| `assigneeId` | string | no | A member's user ID ([find one](https://docs.sofiaspace.uz/api/me-and-workspace.md#find-members-by-name-or-e-mail)) |
| `priority` | string | no | `HIGHEST`, `HIGH`, `MEDIUM` (default), `LOW`, `LOWEST` |
| `dueDate`, `startDate` | string | no | `yyyy-MM-dd`; the start can't be after the due date |
| `storyPoints` | integer | no | Estimate in points, 0 to 1,000 |
| `statusId` | string | no | Start in this status; default is the first status |
| `labelIds` | string[] | no | [Labels](https://docs.sofiaspace.uz/api/projects.md#labels) of this project |
| `parentTaskId` | string | no | Create as a subtask of this task |
| `epicId` | string | no | Put it in this epic |
| `sprintId` | string | no | Put it in this sprint; default is the backlog |
| `teamId`, `componentId` | string | no | Owning team and component |
| `reporterId` | string | no | Who reported it; default is you |
| `fieldValues` | object[] | no | Custom-field values, in the shape [Set custom-field values](#set-custom-field-values) takes. Set in the same step: a bad value refuses the whole create, and no task is made |
| `externalRef` | object | no | The record in another system this task is for: `{"system", "id", "url", "label"}`. If a task you can open already has it, you get that task back instead of a new one — see [Create without duplicates](https://docs.sofiaspace.uz/api/integrations.md#create-without-duplicates) |

```bash
curl -X POST https://acme.sofiaspace.uz/api/v1/projects/9d2e7a10-4b6c-4e8f-a1d3-5c7e9b2f4a68/tasks \
  -H "Authorization: Bearer $SOFIA_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: crm-deal-1042-onboarding" \
  -d '{
    "taskTypeId": "1a3c5e7f-9b2d-4f6a-8c1e-3d5f7a9b2c4e",
    "title": "Onboard new customer (deal #1042)",
    "description": "Contract signed on 12 November. Set up the account and train two users.",
    "assigneeId": "8e4d2b19-6c7a-4f3e-b1d0-3a5c9e8f7d62",
    "priority": "HIGH",
    "dueDate": "2026-11-20"
  }'
```

The answer is the new task (`201`); build its key from the project key and `taskNumber` (`SALES-43`). With an `externalRef` that a task you can open already holds, the answer is `200` with the header `X-Sofia-Existing: true` and that task — nothing new is created.

Errors:

| Status | `code` | Why |
| --- | --- | --- |
| `400` | `NAME_TOO_LONG` | `title` is longer than 500 characters (`params.max`) |
| `400` | `TEXT_TOO_LONG`, `TEXT_TOO_LARGE` | `description` is over its limit |
| `400` | `DATE_RANGE_INVALID`, `DATE_FORMAT_INVALID` | `startDate` after `dueDate`, or a date not `yyyy-MM-dd` |
| `400` | `TASK_HIERARCHY_INVALID` | That nesting isn't allowed, for example an epic as a subtask, or an `epicId` that isn't an epic or phase |
| `400` | `SPRINT_WRONG_PROJECT` | The sprint belongs to another project |
| `400` | `FIELD_VALUE_INVALID` | A field value doesn't fit its field |
| `400` | `NAME_REQUIRED` | `title` is missing or blank |
| `400` | `STORY_POINTS_TOO_HIGH` | `storyPoints` is above 1,000 (`params.max`) |
| `400` | `SUBTASK_DEPTH` | `parentTaskId` is itself a subtask: subtasks are one level deep |
| `400` | `INVALID_ARGUMENT` | An unknown `priority`, a status, label or parent from another project, or a bad `externalRef` |
| `403` | `PERMISSION_DENIED` | You can't create tasks in this project |
| `404` | `NOT_FOUND` | No such project, task type or sprint |
| `409` | `FAILED_PRECONDITION` | The sprint is completed, or a field in `fieldValues` isn't on this project |
| `409` | `EXTERNAL_REF_TAKEN` | The `externalRef` is already linked to a task you can't open (`params.system`, `params.externalId`) |
| `429` | `RATE_LIMITED` | More than 120 tasks created in a minute |

## Update a task

`PUT /api/v1/tasks/{taskId}` — **Scope:** `tasks:write`. Returns the task.

Send **only the fields you change**; a field you leave out stays as it is.

| Field | To clear it |
| --- | --- |
| `title` | can't be cleared; a blank title is refused with `400 NAME_REQUIRED` |
| `description`, `assigneeId`, `dueDate`, `startDate`, `teamId`, `componentId` | send `""` |
| `storyPoints` | send a negative number, for example `-1`. Above 1,000 is refused with `400 STORY_POINTS_TOO_HIGH` |
| `taskTypeId`, `priority` | can't be cleared |

```bash
curl -X PUT https://acme.sofiaspace.uz/api/v1/tasks/7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20 \
  -H "Authorization: Bearer $SOFIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"assigneeId":"2c9a7f41-5b3e-4d1a-8f20-7e6b5c4d3a21","dueDate":"2026-11-25"}'
```

Status, parent, epic, sprint, labels, field values, archiving and [external references](https://docs.sofiaspace.uz/api/integrations.md#link-a-task-to-a-record-in-your-system) have their own endpoints.

## Move a task to another status

`POST /api/v1/tasks/{taskId}/status` — **Scope:** `tasks:write`. Returns the task.

```bash
curl -X POST https://acme.sofiaspace.uz/api/v1/tasks/7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20/status \
  -H "Authorization: Bearer $SOFIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"newStatusId":"6b3c4d5e-7f80-4b92-8c1d-2e3f4a5b6c72"}'
```

The move must follow the project's workflow. If it doesn't, you get `409` with one of `INVALID_TRANSITION`, `INCOMPLETE_SUBTASKS` or `BLOCKED_BY_INCOMPLETE_TASK` in `error` — see [Moving a task: the three workflow refusals](https://docs.sofiaspace.uz/api/errors.md#moving-a-task-the-three-workflow-refusals). To reach a status that has no direct transition, move through the statuses in between.

## Archive or restore a task

`PUT /api/v1/tasks/{taskId}/archived` — **Scope:** `tasks:write`. Body `{"archived": true}` to archive, `{"archived": false}` to restore. Subtasks follow their parent. An archived task leaves every board and list but can be restored.

## Make a task a subtask

`PUT /api/v1/tasks/{taskId}/parent` — **Scope:** `tasks:write`. Body `{"parentTaskId": "…"}`; `{"parentTaskId": null}` or an empty body makes it a top-level task again.

Errors: `400 TASK_PARENT_SELF`, `TASK_PARENT_CYCLE`, `TASK_HIERARCHY_INVALID`; `400 SUBTASK_DEPTH` when the parent is itself a subtask, or the task already has subtasks of its own (subtasks are one level deep).

## Put a task in an epic

`PUT /api/v1/tasks/{taskId}/epic` — **Scope:** `tasks:write`. Body `{"epicId": "…"}`; `null` removes it from its epic.

## Move a task to a sprint or the backlog

`PUT /api/v1/tasks/{taskId}/sprint` — **Scope:** `tasks:write`. Body `{"sprintId": "…"}`; `null` moves it to the backlog. Its subtasks move with it; a subtask itself can't be moved on its own (`400 TASK_HIERARCHY_INVALID` — move the parent). Errors: `400 SPRINT_WRONG_PROJECT`; `409 FAILED_PRECONDITION` for a completed sprint.

## Reorder the backlog (rank)

`PUT /api/v1/tasks/{taskId}/rank` — **Scope:** `tasks:write`. Returns the task with its new `rank`.

Puts the task between two neighbours in the project's backlog order — what dragging a task in the backlog does in the app. List tasks with `sort=rank` to read the order.

| Field | Type | Meaning |
| --- | --- | --- |
| `previousTaskId` | string or `null` | The task that should sit directly **above** it |
| `nextTaskId` | string or `null` | The task that should sit directly **below** it |

- To move it to the very top, send only `nextTaskId` (the current first task); to the very end, send only `previousTaskId` (the current last task). Leave both out, or send no body, to move it to the **bottom** of the backlog.
- Always send both neighbours when you drop it between two tasks: with only one, it is placed one step from that neighbour, which isn't guaranteed to be next to it.
- Both neighbours must be in the same project as the task, and `previousTaskId` must already rank above `nextTaskId`.
- You need to be able to open the project. Only the task moves; other tasks keep their places.

```bash
curl -X PUT https://acme.sofiaspace.uz/api/v1/tasks/7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20/rank \
  -H "Authorization: Bearer $SOFIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"previousTaskId":"3f5a7c9e-1b2d-4e6f-8a0c-2d4f6b8e0a91","nextTaskId":"4a6c8e0b-2d3f-4a7b-9c1e-3f5b7d9f1b02"}'
```

Errors:

| Status | `code` | Why |
| --- | --- | --- |
| `400` | `INVALID_ARGUMENT` | A neighbour belongs to a different project ("previous task belongs to a different project"), or `previousTaskId` ranks below `nextTaskId` ("previous task must rank above next task") |
| `403` | `PERMISSION_DENIED` | You can't open the project |
| `404` | `NOT_FOUND` | No such task or neighbour |

## Add or remove a label

`POST /api/v1/tasks/{taskId}/labels/{labelId}` adds, `DELETE /api/v1/tasks/{taskId}/labels/{labelId}` removes — **Scope:** `tasks:write`. No body; `204` on success. The label must belong to the task's project; [create one](https://docs.sofiaspace.uz/api/projects.md#labels) first if needed.

## Set custom-field values

`PUT /api/v1/tasks/{taskId}/field-values` — **Scope:** `tasks:write`. Sets or clears several fields at once and returns the task.

Each value names its `fieldId` and sets **exactly one** member that matches the [field's type](https://docs.sofiaspace.uz/api/projects.md#custom-fields-of-a-project). A value with no member set **clears** that field.

| Field type | Member | Example |
| --- | --- | --- |
| `TEXT`, `URL` | `text` | `"text": "Contract 2026/114"` |
| `NUMBER`, `MONEY`, `PROGRESS` | `number` (a decimal **string**) | `"number": "125000000"` |
| `DATE` | `date` | `"date": "2026-12-01"` |
| `CHECKBOX` | `checked` | `"checked": true` |
| `DROPDOWN` | `optionId` | `"optionId": "…"` |
| `LABELS` | `optionIds` | `"optionIds": ["…", "…"]` |
| `PEOPLE` | `userIds` | `"userIds": ["…"]` |

```bash
curl -X PUT https://acme.sofiaspace.uz/api/v1/tasks/7c3e9a15-2d4f-4b6a-9e8c-1f3a5b7d9e20/field-values \
  -H "Authorization: Bearer $SOFIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"values":[
        {"fieldId":"f1e2d3c4-b5a6-4978-8a9b-0c1d2e3f4a5b","number":"125000000"},
        {"fieldId":"0a9b8c7d-6e5f-4a3b-9c2d-1e0f9a8b7c6d"}
      ]}'
```

The second value has no member, so it clears that field. Money is sent as a string so large sums in so'm never lose precision.

## What you can't do with the API

- You can't delete a task with a token: `DELETE /api/v1/tasks/{taskId}` answers `403` with `"error": "SIGNED_IN_APP_ONLY"`. [Archive it](#archive-or-restore-a-task) instead, or delete it in the app or from an AI app you signed in to through the [Sofia Space MCP server](https://docs.sofiaspace.uz/integrations/mcp-tools.md).
- You can't move several tasks in one call with a token; move them one by one.
- A task's change history is on [Comments, page links and blockers](https://docs.sofiaspace.uz/api/task-comments-links-blockers.md#read-a-tasks-activity-history).
- You can't list tasks across all projects in one call; list per project, or use [Search](https://docs.sofiaspace.uz/api/search.md).
- You can't move a task to another project.

## Related

- [Comments, page links and blockers](https://docs.sofiaspace.uz/api/task-comments-links-blockers.md)
- [Files and attachments](https://docs.sofiaspace.uz/api/files-and-attachments.md)
- [Time tracking](https://docs.sofiaspace.uz/api/time-tracking.md)
- [Projects and workflow](https://docs.sofiaspace.uz/api/projects.md)
- [Integrations API](https://docs.sofiaspace.uz/api/integrations.md) — create by project key, external references, KPI export
- [Working with tasks](https://docs.sofiaspace.uz/tasks/working-with-tasks.md) — the same things in the app
