Mail guides
09 · Inbox API

Run a shared inbox.

Every mailbox's mail is grouped into conversations. List them across mailboxes, search them, sort them and hand them to a teammate, from your own code or an agent.

No code needed: in the console, Mail › Inbox is the same inbox for people. It shows every mailbox together or one at a time, with folders for archive, spam and trash, your labels, and views for conversations assigned to you or to nobody. Open a conversation to read it, reply, reply all or forward from the mailbox address, and assign or label it. Images from the sender stay blocked until you choose to load them, so nobody can tell you opened their email. Press ? for the keyboard shortcuts.


1

List conversations

GET /threads lists conversations across every mailbox your key or role may list, newest message first. Pass mailbox_id (repeat it for several) to narrow it. The default status is open: the inbox. Use archived, spam, trash or all for the other folders.

GET /threads
curl 'https://api.mail.productcraft.co/v1/workspaces/<ws>/threads?unread=true&assignee=none&limit=25' \
  -H 'authorization: Bearer pcft_live_...'
{
  "data": [
    {
      "id": "8d0c5a8e-...",
      "mailbox": { "id": "703e88ab-...", "address": "support@acme.com" },
      "subject": "Refund for order 42",
      "snippet": "The parcel never arrived...",
      "participants": ["alice@example.com"],
      "message_count": 2,
      "unread_count": 1,
      "has_attachments": false,
      "assignee_account_id": null,
      "labels": [{ "id": "4b1e...", "name": "Needs reply", "color": "#e5484d" }],
      "status": "open",
      "last_message_at": "2026-11-26T18:02:11.000Z",
      "trashed_at": null,
      "has_pending_draft": false
    }
  ],
  "pagination": { "next_cursor": null, "has_more": false }
}

Filters: unread, assignee (me, none or an account id), label (a label id or name; repeat it to require several), q (below), limit and cursor. snippet is the start of the newest received message, and is null unless you hold mail.message.body.read. Open one conversation with every message in it at GET /threads/{id}.


2

Search

q takes words and operators, like a mail client's search box. Every word or "quoted phrase" must appear; -word leaves out conversations with that word. Words match whole words, case-insensitive, in the subject, the addresses and the message text.

The message text is searched only if you can read it. With mail.message.body.read (owners and admins, or a key you granted it), words also match the body. Without it, only subjects and addresses match, so a search can never tell you what an email you may not read says.

OperatorFinds conversations…
from:alice@example.com, from:@acme.comwith a message from an address containing it
to:billing@with a message to (or cc) an address containing it
label:"needs reply"carrying that label
is:unread, is:readwith unread mail, or fully read
is:assigned, is:unassignedassigned to someone, or to nobody
has:attachmentwith a file in any message
after:2026-11-01, before:2026-12-01whose newest message is on or after / before that day (UTC)
in:inbox|archive|spam|trash|allin that folder (overrides status)
Search
curl -G 'https://api.mail.productcraft.co/v1/workspaces/<ws>/threads' \
  --data-urlencode 'q=refund from:@acme.com is:unread after:2026-11-01' \
  -H 'authorization: Bearer pcft_live_...'

A known operator with a bad value (is:starred, before:yesterday), a negated operator, more than 32 terms or more than 256 characters is a 400 with code MAIL_SEARCH_INVALID; details.token names the part it could not read. Unknown word: tokens are searched as words.


3

Triage: read, archive, spam, trash, assign

PATCH /threads/{id} changes one conversation; POST /threads/bulk applies the same change to up to 100. Both need mail.thread.triage on the conversation's mailbox.

PATCH /threads/:id
curl -X PATCH 'https://api.mail.productcraft.co/v1/workspaces/<ws>/threads/<thread-id>' \
  -H 'authorization: Bearer pcft_live_...' \
  -H 'content-type: application/json' \
  -d '{ "read": true, "assignee_account_id": "<member account id>" }'
POST /threads/bulk
curl -X POST 'https://api.mail.productcraft.co/v1/workspaces/<ws>/threads/bulk' \
  -H 'authorization: Bearer pcft_live_...' \
  -H 'content-type: application/json' \
  -d '{ "ids": ["<id-1>", "<id-2>"], "status": "archived", "add_labels": ["<label-id>"] }'
  • status: archived takes it out of the inbox. New mail in the conversation brings it back to open.
  • status: spam or trash moves it there; status: open restores it. A conversation is erased 30 days after it was trashed (trashed_at).
  • read: true / false marks every received message in it read or unread.
  • assignee_account_id must be a member of the workspace (else 400 MAIL_ASSIGNEE_NOT_MEMBER); null unassigns. Checking a teammate needs workspace.member.read; assigning yourself does not. Assignments appear in the workspace audit log.

4

Labels

Labels belong to the workspace (up to 200, names unique regardless of case). Create, rename and delete them with mail.label.manage; put them on conversations with mail.thread.triage.

Labels
# create
curl -X POST 'https://api.mail.productcraft.co/v1/workspaces/<ws>/labels' -H 'authorization: Bearer pcft_live_...' \
  -H 'content-type: application/json' -d '{ "name": "Needs reply", "color": "#e5484d" }'

# list (with how many conversations carry each)
curl 'https://api.mail.productcraft.co/v1/workspaces/<ws>/labels' -H 'authorization: Bearer pcft_live_...'

# label a conversation, and take a label off
curl -X POST 'https://api.mail.productcraft.co/v1/workspaces/<ws>/threads/<thread-id>/labels' -H 'authorization: Bearer pcft_live_...' \
  -H 'content-type: application/json' -d '{ "label_ids": ["<label-id>"] }'
curl -X DELETE 'https://api.mail.productcraft.co/v1/workspaces/<ws>/threads/<thread-id>/labels/<label-id>' -H 'authorization: Bearer pcft_live_...'

5

Keep mail as long as you need

Each mailbox keeps received mail for retention_days (default 7). Set anything from 1 to 3650 days, or null to keep mail until you delete it, which is what a support inbox usually wants:

PATCH /mailboxes/:id
curl -X PATCH 'https://api.mail.productcraft.co/v1/workspaces/<ws>/mailboxes/<mailbox-id>' \
  -H 'authorization: Bearer pcft_live_...' \
  -H 'content-type: application/json' \
  -d '{ "retention_days": null }'

The trash is the exception: a trashed conversation is erased 30 days later, whatever the mailbox keeps.


6

Permissions

ActionLets you
mail.listlist conversations of a mailbox, and labels
mail.message.body.readsee snippets and search message text
mail.thread.triagemark read, archive, spam, trash, restore, assign, add and remove labels
mail.label.managecreate, rename and delete labels

Owners and admins have all of them. Members read and list. The Email and Support assistant presets for API keys and connected agents include mail.thread.triage. Every route is in the API reference.