<Intro>

<EndpointHeader />

<Description>

Returns the messages in a conversation newest first, both received and sent; page older messages with `starting_after` (fixed sort — render conversation order by reversing the page). By default every message that is not in the trash is returned, whichever folder the conversation is in; pass `label` to narrow the view instead — `trash` for trashed messages, or any custom label. Pass `include=extracted_text` to inline each message's extracted plain text. A thread whose retention period has ended returns `410 Gone`.

</Description>

</Intro>

<Parameters in="query">

<Parameter name="direction" type="string">

<Description>

Filter to received (`inbound`) or sent (`outbound`) messages.

</Description>

<Description>

Possible values: `inbound`, `outbound`

</Description>

</Parameter>

<Parameter name="label" type="string">

<Description>

Filter to messages carrying this label. `trash` lists trashed messages; any other label — `archive`, `spam`, `blocked`, `unread`, or a custom label — lists its non-trashed carriers. When omitted, received messages in the inbox and all sent messages are returned.

</Description>

</Parameter>

<Parameter name="include" type="string">

<Description>

Set to `extracted_text` to inline each message's extracted plain text.

</Description>

<Description>

Possible values: `extracted_text`

</Description>

</Parameter>

<Parameter name="limit" type="integer">

<Description>

Maximum number of items to return per page.

</Description>

</Parameter>

<Parameter name="starting_after" type="string">

<Description>

Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.

</Description>

</Parameter>

<Parameter name="ending_before" type="string">

<Description>

Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.

</Description>

</Parameter>

</Parameters>

<Payload kind="response">

<Field name="data" type="array of object" required>

<FieldChildren kind="response">

<Field name="id" type="string" prefix="data." required>

<Description>

Message ID. Received messages carry a `rem_` ID, sent messages an `em_` ID — the same IDs used by the received-message and sent-message logs.

</Description>

</Field>

<Field name="direction" type="string" prefix="data." required>

<Description>

Direction of the message — `inbound` for a received message, `outbound` for a sent one.

</Description>

<Description>

Possible values: `inbound`, `outbound`

</Description>

</Field>

<Field name="channel" type="string" prefix="data." required>

<Description>

Channel this message was carried on. Always `email`.

</Description>

</Field>

<Field name="thread_id" type="string" prefix="data." required>

<Description>

Conversation this message belongs to.

</Description>

</Field>

<Field name="from" type="string" prefix="data." required>

<Description>

Sender address.

</Description>

</Field>

<Field name="to" type="array of string" prefix="data." required>

<Description>

Recipient addresses on the To line.

</Description>

</Field>

<Field name="cc" type="array of string" prefix="data." required>

<Description>

Recipient addresses on the Cc line. Empty when the message had none.

</Description>

</Field>

<Field name="delivered_to" type="nullable string" prefix="data." required>

<Description>

Address the message was actually delivered to, when it differs from the mailbox address (for example mail routed in from another address). Null for sent messages and for mail addressed directly to the mailbox.

</Description>

</Field>

<Field name="subject" type="nullable string" prefix="data." required>

<Description>

Message subject. Null when the message had no subject.

</Description>

</Field>

<Field name="preview" type="nullable string" prefix="data." required>

<Description>

Short plain-text preview of the message body.

</Description>

</Field>

<Field name="extracted_text" type="nullable string" prefix="data.">

<Description>

Plain-text content of the message with quoted history stripped — readable for the mailbox's full retention period, both directions. Always present when fetching a single message; on list endpoints it is included only when the request sets `include=extracted_text`. Null when no text could be extracted.

</Description>

</Field>

<Field name="labels" type="array of string" prefix="data." required>

<Description>

Labels on this message. System labels carry its state: a received message holds exactly one placement label — `inbox` for accepted mail, `archive` when its conversation was filed away, `spam` (failed sender authentication), or `blocked` (rejected by the mailbox's receive policy or rules) — plus `unread` until it is read. `trash` marks a message in the trash, either direction. Custom labels share the same list; a message carries at most 20.

</Description>

</Field>

<Field name="status" type="nullable string" prefix="data." required>

<Description>

Folded delivery status of a sent message: `accepted`, `sent` (provider handoff), `delivered` (all attempted recipients delivered), or `failed` (terminal failure). Null for received messages.

</Description>

</Field>

<Field name="recipients" type="nullable array" prefix="data." required>

<Description>

Terminal per-recipient delivery outcomes of a sent message, folded in as they become known — part of the message's durable memory. Null for received messages and before any recipient reaches a terminal state. Per-recipient event detail lives on the sent-message log (`source`) for 30 days.

</Description>

</Field>

<Field name="authentication" type="nullable string" prefix="data." required>

<Description>

Whether the sender of a received message was authenticated. `pass` means the sender's identity was verified; `fail` means it was checked and did not verify; `unknown` means no verdict could be determined and the sender should not be treated as verified. Null for sent messages. Part of the message's durable memory — readable for the mailbox's full retention period, so the verdict survives after the 30-day inbound log has expired.

</Description>

<Description>

Possible values: `pass`, `fail`, `unknown`, `null`

</Description>

</Field>

<Field name="spf_pass" type="nullable boolean" prefix="data." required>

<Description>

Whether SPF passed for the sender of a received message. Null for sent messages and when no verdict is available. Durable for the mailbox's retention period.

</Description>

</Field>

<Field name="dkim_pass" type="nullable boolean" prefix="data." required>

<Description>

Whether DKIM passed for the sender of a received message. Null for sent messages and when no verdict is available. Durable for the mailbox's retention period.

</Description>

</Field>

<Field name="dmarc_pass" type="nullable boolean" prefix="data." required>

<Description>

Whether DMARC passed for the sender of a received message. Null for sent messages and when no verdict is available. Durable for the mailbox's retention period.

</Description>

</Field>

<Field name="purge_at" type="string" prefix="data." required>

<Description>

When the message will be permanently deleted: the end of the mailbox's retention period, pulled nearer (at most 30 days out) while the message is in the trash. Restore a trashed message before then with `PATCH {"labels": {"remove": ["trash"]}}`.

</Description>

</Field>

<Field name="attachment_count" type="integer" prefix="data." required>

<Description>

Number of attachments on the message.

</Description>

</Field>

<Field name="attachment_manifest" type="array of object" prefix="data." required>

<Description>

Attachment metadata (filename, content type, size). Remains readable for the mailbox's retention period even after the attachment bytes themselves have expired.

</Description>

<FieldChildren kind="response">

<Field name="id" type="string" prefix="data.attachment_manifest." required>

<Description>

Attachment ID, used to download the attachment bytes.

</Description>

</Field>

<Field name="filename" type="nullable string" prefix="data.attachment_manifest." required>

<Description>

Original filename, or null when the attachment had none.

</Description>

</Field>

<Field name="content_type" type="nullable string" prefix="data.attachment_manifest." required>

<Description>

MIME content type, or null when it could not be determined.

</Description>

</Field>

<Field name="size" type="integer" prefix="data.attachment_manifest." required>

<Description>

Attachment size in bytes.

</Description>

</Field>

</FieldChildren>

</Field>

<Field name="reference_ids" type="array of string" prefix="data." required>

<Description>

RFC 5322 References header entries used to thread the conversation.

</Description>

</Field>

<Field name="contact_id" type="nullable string" prefix="data." required>

<Description>

Contact linked to this message, or null when none is linked.

</Description>

</Field>

<Field name="source" type="object" prefix="data." required>

<Description>

Link to the message's entry in the received-message or sent-message log, which carries delivery analytics such as per-recipient events. Log entries expire 30 days after the message occurred.

</Description>

<FieldChildren kind="response">

<Field name="resource" type="string" prefix="data.source." required>

<Description>

API path of the log entry for this message.

</Description>

</Field>

<Field name="available_until" type="string" prefix="data.source." required>

<Description>

When the log entry (and the message's original rendered source) expires.

</Description>

</Field>

</FieldChildren>

</Field>

<Field name="occurred_at" type="string" prefix="data." required>

<Description>

When the message was received or accepted for sending.

</Description>

</Field>

</FieldChildren>

</Field>

<Field name="next_cursor" type="nullable string" required>

<Description>

Cursor for the next page. Pass back as `starting_after` to advance forward. Null when no next page exists.

</Description>

</Field>

<Field name="prev_cursor" type="nullable string" required>

<Description>

Cursor for the previous page. Pass back as `ending_before` to step backward. Null when no previous page exists.

</Description>

</Field>

<Field name="refresh_cursor" type="nullable string" required>

<Description>

Refresh anchor. Pass back as `ending_before` later to fetch items that have appeared since this response. Non-null whenever `data` is non-empty; null only on an empty page. Distinct from `prev_cursor`.

</Description>

</Field>

</Payload>