Mail API reference

Mail API · Threads

get/v1/workspaces/{workspace_id}/threadsAuth

List conversations

Conversations across every mailbox you may list (`mail.list` on `pcft:envoi:mailbox/<id>`), or the ones in `mailbox_id`; newest message first. Filter by `status` (default `open`, the inbox), `unread`, `assignee`, `label` and the search `q`. Words in `q` match message bodies only when you hold `mail.message.body.read`; otherwise only subjects and addresses, and `snippet` is null.

Path parameters

workspace_id*string · uuid

Id of the workspace.

Query parameters

mailbox_idarray

Only these mailboxes (repeat the parameter, or comma-separate). Omit for every mailbox you may list (`mail.list` on `pcft:envoi:mailbox/<id>`). A mailbox you may not list is 403.

statusenum (5)

`open` (the inbox), `archived`, `spam`, `trash`, or `all`. An `in:` operator in `q` overrides it.

unreadboolean

`true`: only threads with unread mail. `false`: only fully read ones.

assigneestring

`me` (yourself; not for API keys), `none` (unassigned) or a member's account id.

labelarray

Only threads carrying every one of these labels: label ids or names (repeat the parameter). An unknown label matches nothing.

qstring

Search. Free words and `"quoted phrases"` must all appear in the subject, a participant address or (only for callers with `mail.message.body.read`) the body of a received message; `-word` excludes a word. Words match whole tokens, case-insensitive, without stemming. Operators: `from:` / `to:` (part of an address, e.g. `from:@acme.com`), `label:<name>` (quote names with spaces: `label:"needs reply"`), `is:unread`, `is:read`, `is:assigned`, `is:unassigned`, `has:attachment`, `after:YYYY-MM-DD` (on or after, UTC), `before:YYYY-MM-DD` (before, UTC), `in:inbox|archive|spam|trash|all` (overrides `status`). A bad operator value, a negated operator, more than 32 terms or over 256 characters is 400 `MAIL_SEARCH_INVALID`.

limitinteger

Page size, 1–100.

cursorstring

Opaque cursor from `pagination.next_cursor`.

Response · 200

data*array

Threads, newest `last_message_at` first.

pagination*object
next_cursor*string

Opaque cursor for the next page. `null` when no more pages are available.

Example: "eyJjcmVhdGVkX2F0IjoiMjAyNi0wNS0wMVQwMDowMDowMFoifQ"

has_more*boolean

True iff another page exists; if true, pass `next_cursor` on the next request.

Example: false

Example

Request

GET https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/threads
Authorization: Bearer YOUR_TOKEN

Response

{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "mailbox": {},
      "subject": "string",
      "snippet": "string",
      "participants": [
        "string"
      ],
      "message_count": 3,
      "unread_count": 1,
      "has_attachments": false,
      "assignee_account_id": "00000000-0000-0000-0000-000000000000",
      "labels": [
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "name": "Needs reply",
          "color": "#e5484d"
        }
      ],
      "status": {},
      "last_message_at": "2026-01-01T00:00:00.000Z",
      "trashed_at": "2026-01-01T00:00:00.000Z",
      "has_pending_draft": false
    }
  ],
  "pagination": {
    "next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0wNS0wMVQwMDowMDowMFoifQ",
    "has_more": false
  }
}