Reading
Finding and reading mail.
Reading tools
| Tool | What it does |
|---|---|
| listThreads | List threads, with filters and pagination: newest, oldest, by sender or by subject, a date range, and only mail from contacts. |
| getThread | One thread’s latest message in full, with its subject and sender. |
| getThreadSummary | An AI summary of one thread. |
| getCurrentDate | The current date and time, for relative queries. |
| getMailboxCounts | How many conversations each folder holds and how many are unread, as the sidebar shows them, how many drafts are waiting, what each label holds in each folder, and how many inbox conversations arrived at each address. address counts the mail of one. |
| getSenderProfile | What is known about the organisation behind a sender, the line the reading pane shows. research looks a new one up, which only the workspace owner may do. |
getThread returns the LATEST message, not the whole thread. For every message in a conversation use GET /threads/{id} on the REST API instead.
getCurrentDate exists because a model has no clock. Without it, "emails from last week" is computed against whenever the model was trained.
Reference
listThreads
List email threads with optional filters, one page at a time. When more follow, the last line gives a pageToken: call again with the same filters and that pageToken for the next page, until none is given. sort is newest (the default), oldest, sender or subject, the same four orders the thread list offers. dateFrom and dateTo are ISO 8601 instants, both included, read against the newest message on each thread. fromContacts keeps only threads whose newest message came from a saved contact. A thread whose newest message arrived encrypted is marked as such on its own line: its subject, sender and date are listed exactly as any other thread’s, but getThread will not return a body for it. Read the marker before planning a call that needs the text. Set semantic to true when the person describes mail rather than naming its words: query then matches by meaning and the closest threads come first. address keeps only the threads delivered to that one address, as the address filter of the app does. category keeps one inbox tab: primary, promotions, updates, social or forums.
Inputs
folderstring- Default
"inbox" querystringMailbox search query. Plain words match loosely (case, accents and separators ignored, parts of words count) against the sender, recipients, subject, body and attachment names, and must all appear. When nothing matches exactly, close spellings are returned instead (benjimin finds Benjamin); a quoted phrase, a number and an excluded word always match exactly. Operators: from:, to:, subject:, body:, label:, in:inbox|sent|drafts|spam|trash|archive|anywhere, is:unread|read|starred|important|snoozed|muted|waiting (sent with a reminder and not answered yet)|subscription (mail from a newsletter or mailing list), category:primary|promotions|updates|social|forums (the inbox tab a thread is sorted into), has:attachment|pdf|image, filename:, after:YYYY/MM/DD, before:YYYY/MM/DD, newer_than:7d, older_than:1m. Quote values with spaces, use OR and parentheses for alternatives, and a leading - to exclude. Example: from:stripe has:pdf newer_than:30d
semanticbooleanWhen true, the plain words in query match by meaning instead of spelling. Describe the mail in a few words (flight to Berlin, invoices I still owe) and the closest threads come back best match first, along with any thread that contains the words. Operators such as from:, label:, is:unread and dates still filter, and sort does not apply. Meaning is read from the whole conversation, newest messages first. A thread with an encrypted message is found only by its sender, subject and labels, and a workspace that turned search by meaning off in its settings gets a text search.
maxResultsinteger- At least 1At most 25Default
5 labelIdsstring[]sortstring- One of
"newest""oldest""sender""subject" dateFromstring- Format
date-time dateTostring- Format
date-time fromContactsbooleanaddressstring- 3 to 320 characters
categorystringKeeps only the threads sorted into one inbox tab: primary, promotions, updates, social or forums. primary is every inbox thread in no other tab. It applies to the inbox only.
One of"primary""promotions""updates""social""forums"pageTokenstring
Also available in
- API
GET /threads- TypeScript
nextmail.threads.list()nextmail.threads.listAll()nextmail.threads.iterate()- Python
threads.list()threads.list_all()threads.iterate()- Ruby
threads.listthreads.list_allthreads.iterate- PHP
threads->listthreads->listAllthreads->iterate- Go
Threads.ListThreads.ListAllThreads.Iterate- Java
threads().listthreads().listAllthreads().iterate- C#
Threads.ListAsyncThreads.ListAllAsyncThreads.IterateAsync
getThread
Get detailed information about a specific email thread. A message that arrived encrypted (PGP or S/MIME) returns a marker in place of its body rather than any text: this server holds no key and cannot open it, and no retry will change that. Sender, subject, date and labels are not hidden by encryption and come back in full. Relay such a message as encrypted. Never report it as empty. When the latest message is a sign-in or verification code email from an authenticated sender and holds exactly one code, that code comes back on its own line.
Inputs
threadIdstringRequired
Also available in
- API
GET /threads/{id}- TypeScript
nextmail.threads.get()- Python
threads.get()- Ruby
threads.get- PHP
threads->get- Go
Threads.Get- Java
threads().get- C#
Threads.GetAsync
getThreadSummary
Get the summary of a specific email thread. A thread holding a message that arrived encrypted (PGP or S/MIME) is never summarised (its body was never read), and this says so rather than reporting that no summary exists. A thread that was summarised before an encrypted message arrived in it returns that older summary, labelled as not covering the encrypted one.
Inputs
idstringRequired
Also available in
getCurrentDate
Get the current date and time
Inputs
Takes no input.
getMailboxCounts
How many conversations each folder holds and how many of them are unread, as the sidebar shows them, how many drafts are waiting, how many conversations each label has in each folder, and how many inbox conversations arrived at each address. The unread row counts the unread conversations in the inbox, and the draft row counts drafts. The tab rows count the inbox conversations in each inbox tab (primary, promotions, updates, social, forums) and how many of them are unread. The unlabelled rows count the inbox conversations that carry none of the labels, in total and by tab, which is what the inbox of the app lists unless Labelled mail is ticked in its Filters menu. The team rows count the open conversations assigned to you, the open conversations nobody has, and the conversations that mention you, with how many of those mentions you have not opened yet. address narrows every count to mail delivered to that one address.
Inputs
addressstring- 3 to 320 characters
Also available in
getSenderProfile
What is known about the organisation behind a sender: the line the reading pane shows under an unfamiliar sender, kept per domain and shared by every address under it, subdomains included, and looked up again after 30 days. Give any address of the sender; only its domain is read. Personal mailbox providers such as Gmail and the domains of this workspace are never looked up. research true looks a domain nobody has looked up yet up on the web and keeps the answer, which only the workspace owner may do, with a connection that reaches every address.
Inputs
emailstringRequired- 3 to 320 characters
researchboolean
Also available in
- API
GET /senders/{email}POST /senders/{email}/research- TypeScript
nextmail.senders.get()nextmail.senders.research()- Python
senders.get()senders.research()- Ruby
senders.getsenders.research- PHP
senders->getsenders->research- Go
Senders.GetSenders.Research- Java
senders().getsenders().research- C#
Senders.GetAsyncSenders.ResearchAsync
Google Workspace