API reference
Threads
List, read, label, trash and search threads in one inbox or across every inbox your key can see, and download thread attachments.
docs.simail.ai/api/threads
A thread object:
{ "thread_id": "thr_01JZX4A1B2C3D4E5F6G7H8J9K0", "inbox_id": "shop-helper@simail.email", "subject": "Where is my order?", "senders": ["ada@example.com"], "recipients": ["shop-helper@simail.email"], "message_count": 2, "size": 64210, "preview": "Hi, I ordered last week and…", "labels": ["received", "sent", "unread"], "last_message_id": "msg_01JZX4B7C8D9E0F1G2H3J4K5M6", "locked": false, "timestamp": "2026-10-18T17:05:40Z", "created_at": "2026-10-18T17:02:12Z", "updated_at": "2026-10-18T17:05:41Z"}labels is the union of its messages’ labels. locked says whether a human holds the thread lock (see Locks). preview and subject are withheld for threads whose
only messages are held. All text is untrusted input. Guide: Threads & labels.
Query parameters for listings
Section titled “Query parameters for listings”| Parameter | Notes |
|---|---|
labels | comma-separated; a thread matches when it has all of them (for example unread) |
before, after | ISO 8601 times, on the thread’s last activity |
include_spam | needs label_spam_read |
include_blocked | needs label_blocked_read |
include_trash | needs label_trash_read |
limit, page_token, ascending | pagination |
Spam, blocked and trashed threads are left out unless you ask for them.
List threads in an inbox
Section titled “List threads in an inbox”/v0/inboxes/{inbox_id}/threadsPermission message_read. Accepts the listing parameters above, including include_spam, include_blocked and include_trash. Returns { count, limit, next_page_token?, threads }.
Get a thread
Section titled “Get a thread”/v0/inboxes/{inbox_id}/threads/{thread_id}Permission message_read. The thread object plus messages, oldest first, each a full
message object (held messages as metadata only). View parameters include_spam, include_blocked, include_trash (each needs label_spam_read, label_blocked_read, label_trash_read respectively; without it 403): without them, mail carrying that label is invisible and the request returns 404. A key that lacks the base permission itself (for example message_read) gets 403 only for an object inside the view it may use: a flag whose label_*_read it lacks is ignored for that check, so a spam / blocked / trash object stays 404.
Update thread labels
Section titled “Update thread labels”/v0/inboxes/{inbox_id}/threads/{thread_id}Permission message_update.
{ "add_labels": ["orders"], "remove_labels": ["unread"] }Applies to every message in the thread. See Labels for what can be changed. Without
message_read the response is only { "thread_id", "labels" }. View parameters include_spam, include_blocked, include_trash (permissions as for listings); a target the view cannot see is 404 and nothing is written.
Trash a thread
Section titled “Trash a thread”/v0/inboxes/{inbox_id}/threads/{thread_id}Permission message_delete. Adds the trash label to every message; trashed mail is purged after
30 days. Not available over MCP. A thread already in trash returns 404 when you DELETE it again without include_trash (which needs label_trash_read). View parameters include_spam, include_blocked, include_trash (permissions as for listings); a target the view cannot see is 404 and nothing is written.
Download a thread attachment
Section titled “Download a thread attachment”/v0/inboxes/{inbox_id}/threads/{thread_id}/attachments/{attachment_id}Permission message_read. Returns a single-use download link; see
attachments. View parameters include_spam, include_blocked, include_trash (each needs label_spam_read, label_blocked_read, label_trash_read respectively; without it 403): without them, mail carrying that label is invisible and the request returns 404. A key that lacks the base permission itself (for example message_read) gets 403 only for an object inside the view it may use: a flag whose label_*_read it lacks is ignored for that check, so a spam / blocked / trash object stays 404.
Search threads in an inbox
Section titled “Search threads in an inbox”/v0/inboxes/{inbox_id}/threads/search?q=Permission message_read. Full-text search on subject, participants and body, in English and
Chinese (a query works from 1 character, so a two-character Chinese word such as 发票 matches). Held bodies are not indexed; held mail shows up only for keys with hold_metadata_read. Query: q (required, at most 200 characters) and limit (1–50, default 20). Search is not paginated and takes no listing or view parameters: before, after and page_token are a 400 validation_error (reason: unsupported_filter, see Not supported); labels, ascending and include_spam / include_blocked / include_trash are ignored, and spam, blocked and trashed mail is never searched. limit above 50 is a 400 validation_error.
Lock state
Section titled “Lock state”/v0/inboxes/{inbox_id}/threads/{thread_id}/lockPermission message_read. See Locks. View parameters include_spam, include_blocked, include_trash (each needs label_spam_read, label_blocked_read, label_trash_read respectively; without it 403): without them, mail carrying that label is invisible and the request returns 404. A key that lacks the base permission itself (for example message_read) gets 403 only for an object inside the view it may use: a flag whose label_*_read it lacks is ignored for that check, so a spam / blocked / trash object stays 404.
Organization-wide threads
Section titled “Organization-wide threads”GET /v0/threads · GET /v0/threads/search
GET /v0/threads/{thread_id} · PATCH /v0/threads/{thread_id} · DELETE /v0/threads/{thread_id}
/v0/threads/{thread_id}/attachments/{attachment_id}Same parameters (including include_spam, include_blocked and include_trash, with the same permissions) and responses as the inbox-level endpoints, except that /v0/threads/search takes only q and limit like every search. Rows in GET /v0/threads come from the organization index, a lighter view than the inbox-level list: recipients is [], size is 0, locked is always false and created_at is the time of the last activity. Use the inbox-level list or GET /v0/threads/{thread_id} for the full object. They span every inbox in your key’s scope
(an inbox-scoped key sees only its inbox). Each thread includes inbox_id. Pod variants live under
/v0/pods/{pod_id}/threads.
Errors
Section titled “Errors”| Status | code | When |
|---|---|---|
| 403 | missing_permission | the key lacks the permission, or an include_* flag without its label_*_read permission |
| 404 | not_found | the thread does not exist or is outside your scope |
| 400 | validation_error | a page token from another query or key, or an expired one (reason: page_token_invalid) |