# REST API reference and access tokens

How to call the Truetask REST API from a script or your own client: base URL, personal access tokens, board-limited keys, filtering, bulk imports and limits.

URL: https://docs.truetask.io/integrations/api

Every Truetask workspace serves a REST API under `/v1`, with an interactive reference built from the live routes.
Anything the app does, a token can do: boards, tasks, notes, forms, time entries, automations, agents and more.

## Base URL and reference

| What | Where |
| --- | --- |
| Base URL | `<workspace>/v1` |
| Interactive reference | `<workspace>/v1/docs` |
| OpenAPI document | `<workspace>/v1/openapi.json` |
| Alternative reference | `<workspace>/v1/redoc` |

Replace `<workspace>` with your own address, for example `https://truetask.example.com`.
The reference is served by the instance itself, so it always matches the version you are running.
In the app, your avatar > **Help** > **API reference** opens it.

## Authentication

Every endpoint takes a personal access token in the `Authorization` header:

```
Authorization: Bearer tt_...
```

Tokens start with `tt_`.
`GET /v1/users/me` is the credential test: it answers 200 with the token's user and 401 for a bad token.

A token carries the access of the person who created it.
It sees the boards they belong to and nothing else, so taking a teammate off a board narrows their tokens too.
Disabling an account stops its tokens at once.

A database's own keys (`ttdb_`) are a different credential: they reach one database's rows through `/v1/db` and are refused everywhere else.
See [Database API keys](https://docs.truetask.io/boards/database-keys) for making one and [Database API](https://docs.truetask.io/integrations/databases) for calling with it.

### Creating a token

Open your avatar in the top bar and choose **Tokens**.
It opens your Profile on the Tokens pane, which lists every key you hold with its permission, when it was last used, its expiry and, for a limited key, its boards.

**Create API token** asks four things:

| Field | What it does |
| --- | --- |
| **Give it a name** | What you will recognise it by later, usually the tool it is for. |
| **Permissions** | **Read only** allows every GET endpoint. **Can edit (read & write)** adds creates, updates and deletes. |
| **Boards** | The boards it may reach. Leave it empty to reach every board you are on. See [Limiting a token to some boards](https://docs.truetask.io/integrations/api#limiting-a-token-to-some-boards). |
| **Set an expiration date (optional)** | Leave it empty for a token that never expires. |

![Truetask Tokens pane in Edit Profile creating a token named for a deploy script, limited to one board](https://docs.truetask.io/screenshots/api-tokens.webp)

The raw value is shown once, on the screen right after you create it, together with a ready curl command.
Copy it then: Truetask stores only a hash and cannot show it to you again.
Revoke a token from the same list when a tool no longer needs it.

The same list opens from the MCP card in the Integrations dialog, behind **Manage your keys**, because a key minted for an AI tool is a personal token like any other.
See [MCP](https://docs.truetask.io/agents/mcp).

### Limiting a token to some boards

A token can name the boards it may reach, on top of its read or write permission.
A key minted for one project's pipeline then sees that project and nothing else.

- Any other board answers 404, the same as a board that does not exist, so a limited key cannot find out what else the workspace holds.
- Cross-board reads stay inside the set: listing boards, search and every other listing that spans boards only return what is on those boards.
- The limit only ever narrows. The token's person still has to be a member of each board, with a role that allows what the token does.
- A token can name up to 50 boards, and only boards its person is on.

**Change boards** on a key's row edits the set later; its name, permission and expiry are fixed when it is created.
Every board added to or taken off a key leaves a row in that board's audit log.

When the token's person leaves a board, or is taken off it, the board drops out of every token they hold.
Joining the board again later does not put it back.
A limited token whose last board is gone reaches nothing: it does not fall back to every board.
Only clearing the boards by hand turns the limit off.

A person signed in to the app is never board-limited; the limit belongs to the credential.

### Every token in the workspace

Workspace owners and admins see every token in the workspace under **Settings > Integrations > API Tokens**, with its owner, scope, boards, last use and expiry.
That pane can revoke any of them, which is how you cut off a tool when someone leaves.

**Create Token** there makes a workspace token, for a script or service rather than for one person's own tools.
It offers a third scope, **Full Access**, for a token that needs the admin-only endpoints; the personal pane deliberately does not.

> **Truetask Cloud only**
>
> Every plan has API tokens, Free included, because MCP connects with them and MCP works on every plan.
> The plan's **Workspace API tokens** limit, shown in the Plan pane's comparison, caps **Create Token** here and new database keys.
> Only the workspace tokens an admin creates in this pane count toward it, together with every database key.
> Tokens people make for themselves in their Profile and the connections of AI tools (MCP, OAuth and the desktop app) never count, on any plan.
> At the limit, **Create Token** says "Your plan's workspace API tokens are all in use. Tokens people make for themselves and their AI tools don't count."
> See [Plans and billing](https://docs.truetask.io/cloud/plans).

## Terminology

The API says `card` where the app says task.
`cards` is the resource, `card.description` is Markdown, and a task's human key (for example `DEVE-123`) is a separate field from its record id.
Endpoints that act on an existing task take the record id, not the key.

## Resource families

| Family | Path |
| --- | --- |
| Boards, board statuses, templates | `/v1/boards`, `/v1/board-statuses`, `/v1/templates` |
| Records: bulk import, update and delete on a board | `/v1/boards/{id}/records` |
| Databases, their keys and visitors | `/v1/db` |
| Lists | `/v1/lists` |
| Tasks | `/v1/cards` |
| Task templates | `/v1/card-templates` |
| Checklists | `/v1/checklists` |
| Comments | `/v1/comments` |
| Tags | `/v1/tags` |
| Folders and groups | `/v1/folders`, `/v1/groups` |
| Dependencies and entity links | `/v1/dependencies`, `/v1/entity-links` |
| Custom fields, values, rollups and formulas | `/v1/xattr` |
| Milestones | `/v1/milestones` |
| Notes, note folders and publications | `/v1/notes`, `/v1/note-folders`, `/v1/note-publications` |
| Forms, and the public submission route | `/v1/forms`, `/v1/forms/public` |
| Files and upload links | `/v1/files`, `/v1/uploads` |
| Time entries, approvals and billing rates | `/v1/time-entries`, `/v1/timesheet-approvals`, `/v1/user-billing-rates` |
| Capacity and workload | `/v1/capacity`, `/v1/workload` |
| Users and saved filters | `/v1/users`, `/v1/saved-filters` |
| Search | `/v1/search` |
| Inbox | `/v1/inbox` |
| Automations | `/v1/automations` |
| Webhooks, incoming endpoints and signing secrets | `/v1/webhooks`, `/v1/webhooks/incoming`, `/v1/signing-secrets` |
| Git connections, repositories and resources | `/v1/git` |
| Agent runs, kickoffs and workflows | `/v1/agent-runs`, `/v1/agent-kickoffs`, `/v1/agent-workflows` |
| Your queue | `/v1/pipelines` |
| Clients and what is shared with them | `/v1/clients`, `/v1/client-shares` |
| Truetask Helper computers | `/v1/helpers` |
| Plugins | `/v1/plugins` |
| Bulk task operations and the workspace export | `/v1/actions` |

The reference at `/v1/docs` groups the routes the same way and documents every payload field.
The client routes are covered with the [client portal](https://docs.truetask.io/clients/).

## Response shapes

Single-record endpoints wrap the record under the resource name, so extraction is always the same rule:

```json
{ "card": { "id": "hho1u99k5u9e0az", "title": "Write the release notes" } }
```

Endpoints that create several records at once extend the same envelope: creating a board returns `board` and `lists`, cloning one also returns `tags` and `xattr_fields`.

List endpoints return a page:

```json
{ "page": 1, "perPage": 300, "totalItems": 412, "totalPages": 2, "items": [] }
```

`totalItems` is the server total for the whole filter, not the number of rows in the page.
Action endpoints (bulk operations, moves, the workspace export) return their own summary, described on the route.

## Paging, sorting and relations

- `page` and `per_page` walk the pages.
- `sort` names a field, with a leading `-` for descending, for example `sort=-created`.
- `expand` pulls related records inline instead of making you fetch them one by one, for example `expand=tags,members,priority`.

Expanding is how you avoid the N+1 trap: ask for the relations you need in the same call.
A filter, a sort or an expand never reaches another person's private fields or a board you are not on.

## Filtering

Most list endpoints take a `filter` string.
The grammar is the same one the MCP tools use:

- Operators: `=`, `!=`, `>`, `>=`, `<`, `<=`, `~` (contains), `!~` (does not contain).
- Strings are double-quoted: `name="alice"`. Booleans are lowercase literals: `archived=true`. Numbers and dates compare directly: `position>1000`, `created>="2026-01-01"`.
- Combine with `&&` and `||`, and parenthesize to group: `(completed=false && priority="<id>") || archived=true`.
- Traverse relations with a dot: `card.board="<id>"`, `board.members~"<user_id>"`.
- Multi-value fields (members, tags, watchers, files) test membership with `~`: `tags~"<tag_id>"` means the task carries that tag.
- Negate with `!field="value"` or `field!="value"`.

Some list endpoints also take purpose-built parameters that are easier than a filter.
`GET /v1/cards`, for example, takes `board`, `completed`, `archived`, `trashed`, `state` (a list of flow categories), `assignee` (`me`, `mine`, `watching`, `none` or a user id) and `team`.

> **Never build a filter by pasting user input**
>
> A filter is a query language, not a search box.
> Quote and escape anything that came from outside your script before it goes into a filter string.

## Examples

List your boards:

```sh
curl -H "Authorization: Bearer $TRUETASK_TOKEN" \
  https://truetask.example.com/v1/boards/
```

Create a task:

```sh
curl -X POST https://truetask.example.com/v1/cards/ \
  -H "Authorization: Bearer $TRUETASK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "title": "Write the release notes",
        "board": "xo300z2ghk3gxkg",
        "list": "bbuh7ij16ee9rei",
        "description": "Cover the import changes and the new webhooks."
      }'
```

The response is `{"card": {...}}` with the stored record, including its generated key and id.

### Retrying a create safely

`POST /v1/cards/` accepts an `idempotency_key`.
A repeat create with the same key on the same board returns the task that already exists, flagged `existing: true`, instead of a duplicate.

```json
{ "title": "Nightly report", "board": "xo300z2ghk3gxkg", "idempotency_key": "nightly-2026-09-22" }
```

Give each item its own stable key so a cron job or a webhook retry that runs twice is a no-op.
Keys are scoped per board, and trashing a task frees its key.

## Bulk operations

Changing many tasks one call at a time is slow and noisy.
The bulk routes under `/v1/actions` do it in one request:

| Endpoint | What it does |
| --- | --- |
| `POST /v1/actions/bulk-update-cards` | Update fields on many tasks |
| `POST /v1/actions/bulk-move-cards` | Move many tasks to a list |
| `POST /v1/actions/bulk-complete-cards` | Complete or reopen many tasks |
| `POST /v1/actions/bulk-archive-cards` | Archive or unarchive many tasks |
| `POST /v1/actions/bulk-manage-members` | Add or remove assignees |
| `POST /v1/actions/bulk-manage-tags` | Add or remove tags |
| `POST /v1/actions/bulk-set-priority` | Set or clear priority |
| `POST /v1/actions/export-workspace` | Export the whole workspace as JSON |

Notes have their own: `POST /v1/notes/bulk-update`.

> **Assignment is not membership**
>
> Assigning someone to a task does not give them access to its board.
> Add them to the board as well, or they will not see the task at all.
> See [Members, roles and teams](https://docs.truetask.io/collaboration/).

## Records: import, update and delete in bulk

The records routes write many tasks of one board, or many rows of a database, in one request, naming every field by its **name** rather than its id.
They are what the app's own import dialog, Truetask AI and the MCP tools use, so a script lands rows exactly the way an import in the app does.

| Endpoint | What it does |
| --- | --- |
| `POST /v1/boards/{id}/records/import` | Create rows, or update the ones that match |
| `POST /v1/boards/{id}/records/import/preview` | What that import would do, row by row, writing nothing |
| `PATCH /v1/boards/{id}/records` | Update many existing rows, each with its own change |
| `POST /v1/boards/{id}/records/absent` | The rows an import never named, reported, tagged or archived |
| `POST /v1/boards/{id}/records/delete` | Move many rows to the trash |
| `POST /v1/boards/{id}/records/import-file` | Import a CSV, TSV or Excel `.xlsx` file already in Truetask |

Each request handles up to 500 rows, and every route needs a token that can edit and a role that can edit the board.

### A row

```json
{
  "title": "Northwind Traders",
  "values": { "Status": "Active", "Amount": 1200.5, "SKU": "NW-001" },
  "links": { "Contact": ["Sam Taylor"] },
  "list": "Leads",
  "tags": ["priority"],
  "members": ["alex@example.com"],
  "start": "2026-11-01",
  "end": "2026-11-30"
}
```

- `values` is keyed by field name, and each value is coerced to the field's type with the import dialog's own rules. A select value the field does not list yet is added as a choice.
- `links` maps a relation field to the titles (or ids) of the records it should link to.
- On a task board, `list`, `tags`, `priority`, `start`, `end` and `members` ride by name. A missing tag is created on the board, and a value that cannot be used becomes a warning, never a failed row.
- `description` is Markdown.

### Matching rows that already exist

An import matches each row to a live row already on the board, by title by default.

| Body field | What it does |
| --- | --- |
| `match_field` | Match on a field's value instead, such as `"SKU"` or `"Email"`. `"key"` matches on the task key the row carries in `key`, by its number only, so a renamed prefix still matches. On a People database, `"email"` matches the person's account email. |
| `on_existing` | `skip` a matching row (the default), `update` that row with it, or `create` a new one anyway. An update replaces the cells and links the row names and keeps the rest. |
| `import_started_at` | Returned by the first request. Send it back on every later chunk of the same file, so rows of one file are never matched against each other. |

`records/import/preview` takes the same body and answers, per row, `create`, `update`, `skip` or `ambiguous` (more than one row carries that value, so the import leaves it alone), with the cells an update would change.
Its `matched_ids` is what `records/absent` subtracts: send them, with an `action` of `tag` or `archive`, to deal with the rows a re-delivered file no longer mentions.

An import never adds a row to a People database: its rows are the workspace's people.

### Updating and deleting many rows

`PATCH /v1/boards/{id}/records` changes up to 500 existing rows and never creates one.
Name each row by `id`, or by `match` (its title, its `match_field` value, or its task key).
A row changes only what it names: `null` in `values` clears a cell, `[]` in `links` clears a relation, and on a task board `completed` and `archived` are there too.

`POST /v1/boards/{id}/records/delete` takes `ids`, or `match` values with a `match_field`.
A value that names more than one row deletes none of them.
Deleted rows go to the board's trash, where Archive & Trash can restore them.

### Importing a CSV or Excel file

`records/import-file` imports a file that is already attached to a task or a note on a board you belong to, and the rows never travel through your script:

```json
{
  "file_id": "f8k2m1x9q0w7e3z",
  "columns": { "Customer": "title", "Due": "end", "Notes": "skip" },
  "on_existing": "update",
  "match_field": "SKU",
  "sheet": "Orders"
}
```

`columns` maps a header to `title`, `description`, `list`, `tags`, `priority`, `start`, `end`, `members`, `key`, `email`, `skip` or a field name.
A header you leave out maps to the field with the same name, or to the task field it names.
`date_order` (`dmy` or `mdy`) settles a date like 06/10/2014 when its column never says.
The answer carries the counts, the mapping it used, the columns it ignored and the workbook's sheets.

To send a file from your own disk instead, mint an upload link: `POST /v1/uploads/tickets` with `"target": "records_import"`, the `board_id` and the same options as `import_options`.
The answer is a single-use URL that expires in ten minutes, and a plain `curl -F file=@orders.xlsx <url>` imports the file with no `Authorization` header.

## Rate limits

> **Self-hosted only**
>
> Rate limiting is a PocketBase instance setting, driven by `POCKETBASE_RATE_LIMIT_ENABLED` in your `.env`.
> The setup script turns it on by default; the shipped Compose file falls back to off when the variable is missing.
> Turn it on for an instance that is reachable from the internet.

Two limits are enforced by Truetask itself regardless of that setting, both on incoming endpoints: 120 requests per minute per endpoint and sender, and a 1 MB body (25 MB for an endpoint that accepts files).
See [Webhooks](https://docs.truetask.io/integrations/webhooks).

A database key has a requests-a-minute limit of its own.
See [Database API](https://docs.truetask.io/integrations/databases#errors-and-limits).

## Frequently asked questions

### Does Truetask have a REST API?

Yes, every Truetask workspace serves a REST API under `/v1`, on Truetask Cloud and on a self-hosted instance alike.
Its interactive reference is at `<workspace>/v1/docs` and its OpenAPI document at `<workspace>/v1/openapi.json`, both built from the routes the instance is running.

### How do I get a Truetask API token?

Open your avatar in the top bar, choose **Tokens**, then **Create API token**, and pick its permission, its boards and an optional expiry.
The token, which starts with `tt_`, is shown once right after you create it, so copy it then.

### Can I limit a Truetask API token to some boards?

Yes, a token can name up to 50 boards it may reach, on top of its read or write permission.
Every other board then answers 404, and searches and listings that span boards only return what is on those boards.

### Is the Truetask API available on the free plan?

Yes, every Truetask Cloud plan has API tokens, Free included.
Tokens people make for themselves and the connections of their AI tools never count toward a plan's limits; only the workspace tokens an admin creates and [database keys](https://docs.truetask.io/boards/database-keys) count toward **Workspace API tokens**.

### What is the difference between the Truetask REST API and the MCP server?

The REST API is for scripts and your own clients, called with a token, while the [MCP server](https://docs.truetask.io/agents/mcp) is for AI tools such as Claude Code or Cursor, which connect with a browser sign-in and act as you or as an agent you own.
Both use the same filter grammar, and both see only the boards of the person or agent they act as.

## Related

- [MCP: connect any AI tool](https://docs.truetask.io/agents/mcp)
- [Database API](https://docs.truetask.io/integrations/databases)
- [Database API keys](https://docs.truetask.io/boards/database-keys)
- [Webhooks](https://docs.truetask.io/integrations/webhooks)
- [Exporting](https://docs.truetask.io/import-export/exporting)
