Mail API reference

Mail API · Threads

post/v1/workspaces/{workspace_id}/threads/bulkAuth

Change many conversations

Applies one change to up to 100 threads at once: `status`, `read`, `assignee_account_id`, `add_labels`, `remove_labels`. All or nothing: needs `mail.thread.triage` on every mailbox the threads are in.

Path parameters

workspace_id*string · uuid

Id of the workspace.

Headers

Idempotency-Keystring

Opaque client-generated string (1–256 chars, `[A-Za-z0-9._:-]`) used to deduplicate retries within a 24h window. A retry with the same key and body returns the original response with `Idempotent-Replay: true`.

Request body

statusobject

`archived` takes it out of the inbox (new mail brings it back), `spam` and `trash` move it there; `open` restores it. A thread is erased 30 days after it was trashed.

readboolean

`true` marks every received message of the thread read, `false` unread.

assignee_account_idstring · uuid

Assign to this workspace member (400 `MAIL_ASSIGNEE_NOT_MEMBER` otherwise); `null` unassigns. Checking someone else needs `workspace.member.read`.

ids*array

Threads to change, at most 100.

add_labelsarray

Label ids to add to every thread.

remove_labelsarray

Label ids to remove from every thread.

Response · 200

updated*array

The threads that were changed.

Example

Request

POST https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/threads/bulk
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "status": {},
  "read": false,
  "assignee_account_id": "00000000-0000-0000-0000-000000000000",
  "ids": [
    "00000000-0000-0000-0000-000000000000"
  ],
  "add_labels": [
    "00000000-0000-0000-0000-000000000000"
  ],
  "remove_labels": [
    "00000000-0000-0000-0000-000000000000"
  ]
}

Response

{
  "updated": [
    "00000000-0000-0000-0000-000000000000"
  ]
}