Python SDK: Mail
The methods of the Python client under Mail. Threads, messages, raw and HTML bodies, attachments and their extracted text.
client.attachments.download
client.attachments.download(message_id: str, filename: str) -> bytesSends attachments.download: GET /v1/attachments/{messageId}/{filename}
Download an attachment.
Access any: any API key, or a console session. An app token needs mail:read.
client.attachments.text
client.attachments.text(message_id: str, filename: str) -> models.AttachmentTextSends attachments.text: GET /v1/attachments/{messageId}/{filename}/text
Read an attachment's text.
Access any: any API key, or a console session. An app token needs mail:read.
client.inboxes.messages.list
client.inboxes.messages.list(inbox_id: str, *, direction: Literal['inbound', 'outbound'] | None = None, limit: int | None = None, offset: int | None = None) -> models.MessageListSends inboxes.messages.list: GET /v1/inboxes/{inboxId}/messages
List messages.
Access any: any API key, or a console session. An app token needs mail:read.
client.inboxes.messages.iterate
client.inboxes.messages.iterate(inbox_id: str, *, direction: Literal['inbound', 'outbound'] | None = None, limit: int | None = None, offset: int | None = None) -> Iterator[models.Message]Every item of client.inboxes.messages.list, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.
client.inboxes.threads.list
client.inboxes.threads.list(inbox_id: str, *, is_read: bool | None = None, q: str | None = None, label: str | None = None, limit: int | None = None, offset: int | None = None) -> models.ThreadPageSends inboxes.threads.list: GET /v1/inboxes/{inboxId}/threads
List threads.
Access any: any API key, or a console session. An app token needs mail:read.
client.inboxes.threads.iterate
client.inboxes.threads.iterate(inbox_id: str, *, is_read: bool | None = None, q: str | None = None, label: str | None = None, limit: int | None = None, offset: int | None = None) -> Iterator[models.Thread]Every item of client.inboxes.threads.list, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.
client.inboxes.threads.list_by_seen
client.inboxes.threads.list_by_seen(inbox_id: str, *, is_seen: bool, q: str | None = None, label: str | None = None, limit: int | None = None, offset: int | None = None) -> models.ThreadPageSends inboxes.threads.listBySeen: GET /v1/inboxes/{inboxId}/threads/by-seen
List threads a person has or has not seen.
Access session: a console session only; an API key gets 403 session_required. App tokens are refused.
client.inboxes.threads.iterate_list_by_seen
client.inboxes.threads.iterate_list_by_seen(inbox_id: str, *, is_seen: bool, q: str | None = None, label: str | None = None, limit: int | None = None, offset: int | None = None) -> Iterator[models.Thread]Every item of client.inboxes.threads.list_by_seen, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.
client.messages.get
client.messages.get(message_id: str) -> models.MessageSends messages.get: GET /v1/messages/{messageId}
Read a message.
Access any: any API key, or a console session. An app token needs mail:read.
client.messages.html
client.messages.html(message_id: str) -> strSends messages.html: GET /v1/messages/{messageId}/html
Read the HTML body.
Access any: any API key, or a console session. An app token needs mail:read.
client.messages.raw
client.messages.raw(message_id: str) -> bytesSends messages.raw: GET /v1/messages/{messageId}/raw
Download the original message.
Access any: any API key, or a console session. An app token needs mail:read.
client.threads.get
client.threads.get(thread_id: str) -> models.ThreadSends threads.get: GET /v1/threads/{threadId}
Read a thread.
Access any: any API key, or a console session. An app token needs mail:read.
client.threads.messages
client.threads.messages(thread_id: str) -> models.ThreadMessagesSends threads.messages: GET /v1/threads/{threadId}/messages
Read a thread's messages.
Access any: any API key, or a console session. An app token needs mail:read.
client.threads.restore
client.threads.restore(thread_id: str) -> models.ThreadSends threads.restore: POST /v1/threads/{threadId}/restore
Restore a trashed thread.
Access session: a console session only; an API key gets 403 session_required. App tokens are refused.
client.threads.seen
client.threads.seen(thread_id: str, body: models.SetThreadSeen) -> models.ThreadSends threads.seen: PUT /v1/threads/{threadId}/seen
Mark a thread seen.
Access session: a console session only; an API key gets 403 session_required. App tokens are refused.
client.threads.trash
client.threads.trash(thread_id: str) -> NoneSends threads.trash: DELETE /v1/threads/{threadId}
Trash a thread.
Access any: any API key, or a console session. An app token needs mail:write and mail:read.
client.threads.update
client.threads.update(thread_id: str, body: models.UpdateThread) -> models.ThreadSends threads.update: PATCH /v1/threads/{threadId}
Update a thread.
Access any: any API key, or a console session. An app token needs mail:write and mail:read.

