Skip to the documentation
CLI

nextmail threads

Every command in this namespace, with its arguments, flags and examples.

Commands

Read, search, label, trash, snooze and mute conversations in the mailbox, read the inbox one tab at a time, and choose the tab the mail of a sender always goes to.

Every command here also takes the global flags, such as --json, --profile and --dry-run. See the global flags

nextmail threads list

List one page of threads in a folder

Scopesthreads:readNeeds a sign-inAliasesls

Usage

nextmail threads list [flags]

Returns one page of threads from the mailbox index, ordered by each thread's latest message with the newest first unless sort says otherwise. A row is only object and id, so call get for the messages, labels and unread state.

sort, --date-from, --date-to and --from-contacts are the thread list's own controls: the four orders, a date range read against the newest message on each thread, and a filter to mail from saved contacts. Every order pages to the end, and a cursor carries on in the order it was handed out in, so send the same filters with it.

folder defaults to inbox and is matched against label ids after being upper cased, so sent, archive, spam, trash, draft, snoozed, starred and unread all work, bin is read as trash, and a user label id works as a folder too. A name that matches nothing returns an empty page rather than an error. --label-ids narrows the folder further: a thread must carry the folder label and every id you pass. category keeps one inbox tab, primary, promotions, updates, social or forums, where primary is every thread in no other tab.

query takes the mailbox search syntax. Plain words must all appear, and each matches loosely: case, accents and separators are ignored and part of a longer word counts, so min finds "Benjamin". A quoted phrase is matched as written apart from case and accents, so "ben jamin" does not find "Ben-Jamin" while "quarterly invoice" finds "Quarterly invoice". When nothing matches exactly, close spellings are returned instead, so benjimin finds "Benjamin": a plain word, or the value of from:, to:, cc:, subject:, body:, filename: or label:, may differ from the start of a word by one typo when it has four to seven letters and by two when it has eight or more, while a quoted phrase, a word containing a digit, a shorter word and an excluded word still match exactly, and the pages that follow keep matching the same way. Filler words such as the, about or emails are dropped from a list of plain words when something else is left to search for, so emails from john searches for john alone. Operators such as from:, to:, subject:, label:, is:unread, has:pdf, after:2026/01/31 and newer_than:7d narrow it, and OR, parentheses and a leading - combine them. is:muted finds muted threads, is:waiting the threads with a reminder nobody has answered yet, and category:promotions one inbox tab in any folder. Recipients are stored as one list without roles and never hold a Bcc, so cc: reads the same field as to: and bcc: matches nothing of its own. from:me is mail you sent, and to:me is mail carrying one of your own addresses, aliases included, among its recipients or as the address it was delivered to.

With semantic: true the plain words of query match by meaning rather than spelling. Describe the mail in a few words, flight to Berlin or invoices I still owe, in any language, and the threads closest in meaning come back best match first, together with every thread the words match as text, which ranks above one that only means the same. A thread is kept only when it is clearly closer to the words than the rest of the mailbox, so a description nothing fits returns only the text matches. Operators and filters narrow it as usual, sort does not apply, and a query with no plain words is a text search whatever semantic says. Meaning is read from the whole conversation, newest messages first, so an earlier message counts too, and a workspace that turned search by meaning off in its settings gets a text search instead.

Words and the from:, to:, cc:, subject: and body: operators read only the newest message on each thread: its sender, its recipients, its subject and the first 4,000 characters of its body with markup stripped. filename: and has: read every attachment on the whole conversation, and label:, in: and is: read the whole conversation. A plain word also matches the name of any attachment on the conversation, whichever message carried it. A sealed message has no body text to match. The search stays inside folder unless the query names a folder itself, with in: or a folder is: such as is:sent, and in:anywhere searches every folder, on its own as well as beside other terms. A drafts listing is the exception and stays in drafts whatever the query names.

Dates read the newest activity on the thread, in UTC. after: includes the day it names and before: excludes it, and a date can be written YYYY/MM/DD, YYYY-MM-DD, YYYYMMDD, as a bare year, or as epoch seconds or milliseconds. A short date reads day first (16/09/2026), unless the second number cannot be a month (09/16/2026), and a number above 12 settles it either way. The API pages with an opaque pageToken, which the SDK hands back as nextCursor and accepts as --cursor.

Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.

Flags

--folder <value>

Label the threads must carry, case insensitive. Defaults to inbox, and bin is read as trash.

Default"inbox"
--query <value>

Mailbox search. Plain words must all appear and match loosely, a quoted phrase has to appear as written, filler words are dropped when something else is left to search for, and operators such as from:ada, has:pdf and in:anywhere narrow it.

--label-ids <a,b>Repeatable

Label ids a thread must all carry on top of folder, matched exactly. An array is sent comma separated.

--sort <value>

newest (the default), oldest, sender or subject, the four orders of the thread list in the app. sender and subject are alphabetical, newest first within one sender or subject.

Default"newest"
--date-from <when>

Keeps threads whose newest message arrived at or after this instant. A Date or an ISO 8601 string with a time and an offset.

--date-to <when>

Keeps threads whose newest message arrived at or before this instant. Both ends are included, and --date-from after --date-to is a 422.

--from-contacts

When true, keeps only threads whose newest message came from a saved contact. A key limited to some addresses reads the contacts its owner saved.

--semantic

When true, the plain words of query match by meaning instead of spelling, in any language, and the closest threads come first along with every thread the words match as text. Operators and the other filters still apply and sort does not. Ignored when the workspace has search by meaning turned off.

--category <value>

Keeps only the threads sorted into this inbox tab: primary, promotions, updates, social or forums. primary is every thread in no other tab. In query, category:promotions filters the same way in any folder.

--address <value>

Keeps only the threads delivered to this address, the address filter of the thread list. One the key does not reach returns nothing rather than failing.

--limit <n>

Threads per page, a whole number from 1 to 100. Defaults to 25.

--cursor <value>

The nextCursor of the previous page, passed back unchanged.

--all

Fetch every page and stream the items as they arrive.

--max <n>

Stop after this many items. Implies --all.

--ndjson

Print every item as one JSON object per line. Implies --all

Examples

nextmail threads list
With optional flags
nextmail threads list --folder inbox --query 'from:ada has:pdf' --sort oldest
Walk every page and stop after 100 items
nextmail threads list --all --max 100
One JSON object per line when piped
nextmail threads list --all > threads.ndjson

Also available in

API
GET /threads
TypeScript
nextmail.threads.list()
Python
threads.list()
Ruby
threads.list
PHP
threads->list
Go
Threads.List
Java
threads().list
C#
Threads.ListAsync

nextmail threads get

Read a thread with every message on it

Scopesthreads:readNeeds a sign-inAliasesshowview

Usage

nextmail threads get <id> [flags]

Returns the whole conversation, oldest message first, with the labels the thread sits in and its unread state. Unsent draft replies are included in messages with isDraft: true, which is why messageCount, the length of messages, can be higher than totalReplies, which counts only real messages.

Messages are passed through as the mailbox stored them, so MessageResource is an open record rather than a fixed field list. The one field the API commits to is encryption. When encryption.format is pgp-mime, pgp-inline or smime-encrypted, the message is sealed and its body is empty or holds armour. pgp-signed and smime-signed are ordinary readable mail. A message with no encryption at all was stored before detection existed, so its absence says nothing about whether it was plaintext.

Each message's tags and unread are overwritten on read with the thread's current labels and unread flag, so they describe the thread and not that one message.

Arguments

<id>Required

Thread id, as returned by list or carried on a message.

Examples

nextmail threads get CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads get CAHk7pQ2x9LmZ4-mail.example.com --json

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

nextmail threads update

Mark a thread read or unread and change its labels

Scopesthreads:writeNeeds a sign-inAliasesedit

Usage

nextmail threads update <id> [flags]

Adds and removes labels on a thread in one call. read is shorthand for the UNREAD label: true removes it and false adds it. At least one of read, a non empty --add-label-ids or a non empty --remove-label-ids is required, each list takes at most 50 ids, and any other key is a 422 because the body is strict.

Folders are labels too, so archiving is addLabelIds: ['ARCHIVE'] with removeLabelIds: ['INBOX'], the same pair the app uses. TRASH, SNOOZED and DRAFT are refused in either list with 422 label_not_directly_settable, because each needs a step this route cannot take. Use trash and snooze for those.

User label ids come from labels.list, and the system ids such as ARCHIVE, STARRED and UNREAD are taken in any case. An id in --add-label-ids that names no label is refused with 422 label_not_found and nothing on the thread changes, so create the label with labels.create first. An unknown id in --remove-label-ids is not an error, since the thread cannot carry it. Removals are applied before additions, so an id in both lists ends up on the thread.

Arguments

<id>Required

Thread id.

Flags

--read

true removes UNREAD, false adds it.

--add-label-ids <a,b>Repeatable

Label ids to put on the thread, at most 50, each naming a label, never TRASH, SNOOZED or DRAFT.

--remove-label-ids <a,b>Repeatable

Label ids to take off the thread, at most 50, never TRASH, SNOOZED or DRAFT.

--data <json|@file|->

The whole patch as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Examples

With optional flags
nextmail threads update CAHk7pQ2x9LmZ4-mail.example.com --read --add-label-ids ARCHIVE,USER_RECEIPTS --remove-label-ids INBOX
Print the raw JSON
nextmail threads update CAHk7pQ2x9LmZ4-mail.example.com --read --add-label-ids ARCHIVE,USER_RECEIPTS --remove-label-ids INBOX --json

Also available in

API
PATCH /threads/{id}
TypeScript
nextmail.threads.update()
Python
threads.update()
Ruby
threads.update
PHP
threads->update
Go
Threads.Update
Java
threads().update
C#
Threads.UpdateAsync

nextmail threads trash

Move a thread to the Bin

Scopesthreads:writeNeeds a sign-in
Asks you to confirm

Usage

nextmail threads trash <id> [flags]

Adds TRASH and removes INBOX, SPAM, SNOOZED and ARCHIVE in one step, which is what the app's delete does. Doing half of that through update would leave the thread listed in both the Bin and its old folder, which is why update refuses TRASH.

Nothing is deleted. The thread stays readable with get and lists under folder: 'trash'. Calling this on a thread that is already in the Bin changes nothing and returns the same body, which is why the SDK retries it.

Arguments

<id>Required

Thread id.

Examples

nextmail threads trash CAHk7pQ2x9LmZ4-mail.example.com
Skip the confirmation, for scripts
nextmail threads trash CAHk7pQ2x9LmZ4-mail.example.com --yes

Also available in

API
POST /threads/{id}/trash
TypeScript
nextmail.threads.trash()
Python
threads.trash()
Ruby
threads.trash
PHP
threads->trash
Go
Threads.Trash
Java
threads().trash
C#
Threads.TrashAsync

nextmail threads snooze

Hide a thread until a set time

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads snooze <id> <wake-at> [flags]

Adds SNOOZED, removes INBOX and stores a wake time, all in one call. Both halves matter: the label hides the thread and the stored wake time is what brings it back. A thread labelled SNOOZED any other way would never return, which is why update refuses that label.

wakeAt takes a Date or an ISO 8601 string. The SDK converts a Date with toISOString(), and the server answers 422 invalid_parameter on wakeAt when the value does not parse or is not in the future. Snoozing a thread that is already snoozed replaces its wake time.

Threads are woken by an hourly sweep, so one comes back at the first sweep after wakeAt, up to about an hour late. Opening the Snoozed folder in the app wakes overdue threads straight away. A thread always wakes into the inbox.

Arguments

<id>Required

Thread id.

<wake-at>Required

When the thread should return, a future instant.

Examples

nextmail threads snooze CAHk7pQ2x9LmZ4-mail.example.com 2026-10-01T00:00:00Z
Print the raw JSON
nextmail threads snooze CAHk7pQ2x9LmZ4-mail.example.com 2026-10-01T00:00:00Z --json

Also available in

API
POST /threads/{id}/snooze
TypeScript
nextmail.threads.snooze()
Python
threads.snooze()
Ruby
threads.snooze
PHP
threads->snooze
Go
Threads.Snooze
Java
threads().snooze
C#
Threads.SnoozeAsync

nextmail threads unsnooze

Bring a snoozed thread back now

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads unsnooze <id> [flags]

Adds INBOX, removes SNOOZED and deletes the stored wake time, so the thread returns immediately and the hourly sweep leaves it alone afterwards.

A thread that is not snoozed is left where it is, so an archived thread stays archived, and the response still reports snoozedUntil: null.

Arguments

<id>Required

Thread id.

Examples

nextmail threads unsnooze CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads unsnooze CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
POST /threads/{id}/unsnooze
TypeScript
nextmail.threads.unsnooze()
Python
threads.unsnooze()
Ruby
threads.unsnooze
PHP
threads->unsnooze
Go
Threads.Unsnooze
Java
threads().unsnooze
C#
Threads.UnsnoozeAsync

nextmail threads mute

Mute a thread

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads mute <id> [flags]

Mutes a conversation, as Mute does in the app. A thread in the inbox moves to the archive, and from then on new mail in it goes straight to the archive, unread, with no push, sound or desktop notice. A webhook for that mail carries muted: true.

Thread state belongs to the whole workspace, so the thread is muted for everyone on it, and mail addressed only to you does not bring it back. Calling it again changes nothing, which is why the SDK retries it. update with MUTE in addLabelIds does the same.

Arguments

<id>Required

Thread id.

Examples

nextmail threads mute CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads mute CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
POST /threads/{id}/mute
TypeScript
nextmail.threads.mute()
Python
threads.mute()
Ruby
threads.mute
PHP
threads->mute
Go
Threads.Mute
Java
threads().mute
C#
Threads.MuteAsync

nextmail threads unmute

Take the mute off a thread

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads unmute <id> [flags]

Takes the mute off, so the next message in the thread arrives in the inbox and alerts people again.

The thread stays where it is. Move it back with update and INBOX in addLabelIds if you want it in the inbox now. A thread that is not muted is left as it is, which is why the SDK retries this call.

Arguments

<id>Required

Thread id.

Examples

nextmail threads unmute CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads unmute CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
POST /threads/{id}/unmute
TypeScript
nextmail.threads.unmute()
Python
threads.unmute()
Ruby
threads.unmute
PHP
threads->unmute
Go
Threads.Unmute
Java
threads().unmute
C#
Threads.UnmuteAsync

nextmail threads list-messages

List the messages of a thread in a fixed shape

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads list-messages <id> [flags]

Returns every message on the thread, oldest first, as MailboxMessageResource: from, to, cc, bcc and replyTo as { name, email }, date as an ISO 8601 instant, messageId, inReplyTo and references, the body as text and html, the attachments without their bytes, the headers Nextmail keeps and encryption. Unsent draft replies are in the list with draft: true.

These fields are a contract: they are added to, never renamed or taken away, whatever the mailbox stores underneath. threads.get still returns each message the way the mailbox stored it, so use this when your code reads messages field by field.

text is the plain text body, or the text drawn from the HTML when the message came as HTML only. html is null for a plain text message. headers holds From, To, Cc, Reply-To, Subject, Date, Message-ID, In-Reply-To, References, List-Unsubscribe and List-Unsubscribe-Post when the message had them, and nothing else, because the rest of what it arrived with is not kept.

Arguments

<id>Required

Thread id, as returned by list.

Examples

nextmail threads list-messages thr_2b8e4c1a9d7f4e3b8a6c5d0e
Print the raw JSON
nextmail threads list-messages thr_2b8e4c1a9d7f4e3b8a6c5d0e --json

Also available in

API
GET /threads/{id}/messages
TypeScript
nextmail.threads.listMessages()
Python
threads.list_messages()
Ruby
threads.list_messages
PHP
threads->listMessages
Go
Threads.ListMessages
Java
threads().listMessages
C#
Threads.ListMessagesAsync

nextmail threads get-message

Read one message of a thread in a fixed shape

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads get-message <id> <message-id> [flags]

Returns one message as MailboxMessageResource, the shape listMessages lists. The thread is checked first and then the message, so a messageId that is not on that thread is a 404 even when it exists elsewhere in the mailbox.

The emailId of an email.received webhook is the messageId to pass here, beside its threadId.

Arguments

<id>Required

Thread id the message belongs to.

<message-id>Required

The message, as id on a message listMessages returns.

Examples

nextmail threads get-message thr_2b8e4c1a9d7f4e3b8a6c5d0e msg_7c2e9a41b3d84f6e9a0c1d2e
Print the raw JSON
nextmail threads get-message thr_2b8e4c1a9d7f4e3b8a6c5d0e msg_7c2e9a41b3d84f6e9a0c1d2e --json

Also available in

API
GET /threads/{id}/messages/{messageId}
TypeScript
nextmail.threads.getMessage()
Python
threads.get_message()
Ruby
threads.get_message
PHP
threads->getMessage
Go
Threads.GetMessage
Java
threads().getMessage
C#
Threads.GetMessageAsync

nextmail threads list-attachments

List a message's attachments with their content

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads list-attachments <id> <message-id> [flags]

Returns the attachments of one message with each file's bytes inlined as base64 in content. The thread is checked first and then the message, so a messageId that is not on that thread is a 404 even when it exists elsewhere in the mailbox. Take message ids from the messages of threads.get.

This is the display list. The ciphertext of an encrypted envelope is in it and downloads like any other file, named encrypted-message.asc when it arrived without a name. The PGP/MIME version part and any detached signature are held out on purpose. Every part keeps its id in the message's encryption.parts, and for those two the id is a correlation key only: no route returns their bytes.

Every file comes back whole in a single response, with no size cap and no range reads, so a message carrying large files makes a large response.

Arguments

<id>Required

Thread id the message belongs to.

<message-id>Required

Message id from that thread's messages.

Examples

nextmail threads list-attachments CAHk7pQ2x9LmZ4-mail.example.com msg_7c2e9a41b3d84f6e9a0c1d2e
Print the raw JSON
nextmail threads list-attachments CAHk7pQ2x9LmZ4-mail.example.com msg_7c2e9a41b3d84f6e9a0c1d2e --json

Also available in

API
GET /threads/{id}/messages/{messageId}/attachments
TypeScript
nextmail.threads.listAttachments()
Python
threads.list_attachments()
Ruby
threads.list_attachments
PHP
threads->listAttachments
Go
Threads.ListAttachments
Java
threads().listAttachments
C#
Threads.ListAttachmentsAsync

nextmail threads list-notes

List the notes on a thread

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads list-notes <id> [flags]

Resolves every note on one thread, the Notes panel of the reading pane: pinned notes first, then the rest in the order they were arranged.

Notes are private to a person. A key reads and writes the notes of the workspace owner, and an app those of the person who connected it. A key limited to particular addresses reaches only the notes on threads that arrived at them.

Arguments

<id>Required

Thread id.

Examples

nextmail threads list-notes CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads list-notes CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
GET /threads/{id}/notes
TypeScript
nextmail.threads.listNotes()
Python
threads.list_notes()
Ruby
threads.list_notes
PHP
threads->listNotes
Go
Threads.ListNotes
Java
threads().listNotes
C#
Threads.ListNotesAsync

nextmail threads create-note

Add a note to a thread

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads create-note <id> --content <value> [flags]
nextmail threads create-note <id> --data <json|@file|-> [flags]

Pins a private note to a thread, as the Notes panel does. A new note goes after the others, and pinned keeps it at the top.

Notes are private to a person. A key reads and writes the notes of the workspace owner, and an app those of the person who connected it. A key limited to particular addresses reaches only the notes on threads that arrived at them.

Arguments

<id>Required

Thread id.

Flags

--content <value>

The text of the note, up to 20,000 characters. Leading and trailing spaces are trimmed. Required, here or in --data.

--body-color <value>

One of the eight the app offers: default, red, orange, yellow, green, blue, purple or pink. Defaults to default.

--pinned

Keeps the note above the others. Defaults to false.

--data <json|@file|->

The whole body as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Examples

The required values only
nextmail threads create-note CAHk7pQ2x9LmZ4-mail.example.com --content 'Waiting on the signed contract before replying.'
With optional flags
nextmail threads create-note CAHk7pQ2x9LmZ4-mail.example.com --content 'Waiting on the signed contract before replying.' --body-color yellow --pinned
Read the whole body from a JSON file
nextmail threads create-note CAHk7pQ2x9LmZ4-mail.example.com --data @thread.json

Also available in

API
POST /threads/{id}/notes
TypeScript
nextmail.threads.createNote()
Python
threads.create_note()
Ruby
threads.create_note
PHP
threads->createNote
Go
Threads.CreateNote
Java
threads().createNote
C#
Threads.CreateNoteAsync

nextmail threads update-note

Change a note

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads update-note <id> <note-id> [flags]

Changes the text of a note, its colour or whether it is pinned. Give at least one of the three. A note id that is not on this thread is a 404, even when the note exists on another thread.

Arguments

<id>Required

Thread id.

<note-id>Required

The note's id, from listNotes.

Flags

--content <value>

The new text, up to 20,000 characters.

--patch-color <value>

The new colour.

--pinned

Pins or unpins it.

--data <json|@file|->

The whole patch as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Examples

With optional flags
nextmail threads update-note CAHk7pQ2x9LmZ4-mail.example.com b3d1f0c2-7a4e-4f7b-9c1d-2e8f6a5b4c3d --no-pinned
Print the raw JSON
nextmail threads update-note CAHk7pQ2x9LmZ4-mail.example.com b3d1f0c2-7a4e-4f7b-9c1d-2e8f6a5b4c3d --no-pinned --json

Also available in

API
PATCH /threads/{id}/notes/{noteId}
TypeScript
nextmail.threads.updateNote()
Python
threads.update_note()
Ruby
threads.update_note
PHP
threads->updateNote
Go
Threads.UpdateNote
Java
threads().updateNote
C#
Threads.UpdateNoteAsync

nextmail threads delete-note

Delete a note

Scopesthreads:writeNeeds a sign-in
Asks you to confirm

Usage

nextmail threads delete-note <id> <note-id> [flags]

Deletes a note for good. There is no bin for notes.

Arguments

<id>Required

Thread id.

<note-id>Required

The note's id, from listNotes.

Examples

nextmail threads delete-note CAHk7pQ2x9LmZ4-mail.example.com b3d1f0c2-7a4e-4f7b-9c1d-2e8f6a5b4c3d
Skip the confirmation, for scripts
nextmail threads delete-note CAHk7pQ2x9LmZ4-mail.example.com b3d1f0c2-7a4e-4f7b-9c1d-2e8f6a5b4c3d --yes

Also available in

API
DELETE /threads/{id}/notes/{noteId}
TypeScript
nextmail.threads.deleteNote()
Python
threads.delete_note()
Ruby
threads.delete_note
PHP
threads->deleteNote
Go
Threads.DeleteNote
Java
threads().deleteNote
C#
Threads.DeleteNoteAsync

nextmail threads reorder-notes

Arrange the notes on a thread

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads reorder-notes <id> <ids...> [flags]

Sets the order of every note on a thread at once, first to last, as dragging them in the Notes panel does. Pinned notes still come first.

ids has to name every note on the thread exactly once. Anything else is a 422 invalid_parameter on ids, and nothing moves.

Arguments

<id>Required

Thread id.

<ids...>RequiredOne or more

Every note id on the thread, in the order you want them.

Examples

nextmail threads reorder-notes CAHk7pQ2x9LmZ4-mail.example.com CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads reorder-notes CAHk7pQ2x9LmZ4-mail.example.com CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
POST /threads/{id}/notes/reorder
TypeScript
nextmail.threads.reorderNotes()
Python
threads.reorder_notes()
Ruby
threads.reorder_notes
PHP
threads->reorderNotes
Go
Threads.ReorderNotes
Java
threads().reorderNotes
C#
Threads.ReorderNotesAsync

nextmail threads counts

Count the mail in each folder

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads counts [flags]

Resolves what the sidebar of the app shows: how many conversations each folder holds and how many of them are unread, how many drafts are waiting, how many conversations each of your labels has in each folder, how many inbox conversations sit in each inbox tab, and how many inbox conversations arrived at each address of the workspace.

folders has one row per folder, named by its label id in lower case: inbox, sent, spam, archive, trash and snoozed, then draft, whose count is the drafts waiting to be sent and whose unread is always 0, then unread, whose count is the unread conversations in the inbox. labels has one row for each of your labels and each folder it has conversations in, { id, folder, count, unread }, so a label with nothing in a folder has no row for it. categories has one row for each inbox tab, { category, count, unread }, counting inbox conversations only: primary, promotions, updates, social and forums, where primary is everything not sorted into another tab. unlabelled counts the inbox conversations that carry none of your labels, with count, unread and the same count for each tab under categories, which is what the inbox of the app lists unless Labelled mail is ticked in its Filters menu. addresses counts the inbox per address the mail was delivered to, with null for mail that recorded none. team counts the team views of a shared inbox for the person the key or app acts for: assigned the open conversations assigned to them, unassigned the open conversations nobody has, each with count and unread, and mentions the conversations outside Spam and the bin where a team comment mentions them, with count, unread and unseen, the conversations with a mention newer than the last time they opened its comments in the app. A conversation is open while it is in the inbox.

A key limited to particular addresses counts only the mail that arrived at them and the drafts written from them. address narrows every count to one address, and one the key does not reach counts nothing rather than failing.

Flags

--address <value>

Count only the mail delivered to this address.

Examples

nextmail threads counts
Print the raw JSON
nextmail threads counts --json

Also available in

API
GET /threads/counts
TypeScript
nextmail.threads.counts()
Python
threads.counts()
Ruby
threads.counts
PHP
threads->counts
Go
Threads.Counts
Java
threads().counts
C#
Threads.CountsAsync

nextmail threads summary

Read the summary of a thread

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads summary <id> [flags]

Resolves the short AI summary the reading pane shows above a thread. A summary is written the first time it is asked for and then kept, and the first request after a newer message arrives writes it again, so reading one is cheap.

state is ready with the text in summary, pending while the first one is being written, failed when the last try did not work, or none when there is nothing to summarise, such as a thread holding a message that arrived encrypted, whose body Nextmail never reads. While a newer summary is being written, the one before it comes back as ready. A pending answer starts the writing, so ask again a few seconds later, and after a failed one asking again tries once more.

Arguments

<id>Required

Thread id.

Examples

nextmail threads summary CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads summary CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
GET /threads/{id}/summary
TypeScript
nextmail.threads.summary()
Python
threads.summary()
Ruby
threads.summary
PHP
threads->summary
Go
Threads.Summary
Java
threads().summary
C#
Threads.SummaryAsync

nextmail threads reply-suggestions

Suggest replies to a thread

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads reply-suggestions <id> [flags]

Resolves up to three short replies to the latest message of the thread, the ones the reading pane offers under it. Each has a label, a few words that say what it answers, and a body, the reply itself in plain text, ready to send with emails.send or to keep with drafts.create. They are written in the language of that message and the voice of the mail this workspace sends, from the conversation, what was written to this correspondent before, what is known about their organisation and, when the message asks for a time, the busy times of the calendar.

Suggestions are written once for each new message and kept, so asking again is free until another message arrives. state is ready with the suggestions, pending while they are being written, so ask again a few seconds later, or none when the message needs no reply: your own reply came last, or it is a newsletter, an automated notice, mail from a no-reply address, spam or an encrypted message. Every thread is none in a workspace that turned replySuggestions off with settings.update.

sources names the knowledge base items the suggestions drew on: the pinned notes at the levels of the receiving address and the items whose passages matched the message, each a KnowledgeSourceRef with id, title, kind, scope and url. It is empty when none were used.

Arguments

<id>Required

Thread id.

Examples

nextmail threads reply-suggestions CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads reply-suggestions CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
GET /threads/{id}/reply-suggestions
TypeScript
nextmail.threads.replySuggestions()
Python
threads.reply_suggestions()
Ruby
threads.reply_suggestions
PHP
threads->replySuggestions
Go
Threads.ReplySuggestions
Java
threads().replySuggestions
C#
Threads.ReplySuggestionsAsync

nextmail threads restore

Take a thread out of the Bin

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads restore <id> [flags]

Puts a thread back in the inbox, out of the Bin and out of Spam, which is what Restore from Bin and Move to inbox do in the app. It is the undo of trash.

Calling it on a thread that is already in the inbox changes nothing and returns the same body, which is why the SDK retries it.

Arguments

<id>Required

Thread id.

Examples

nextmail threads restore CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads restore CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
POST /threads/{id}/restore
TypeScript
nextmail.threads.restore()
Python
threads.restore()
Ruby
threads.restore
PHP
threads->restore
Go
Threads.Restore
Java
threads().restore
C#
Threads.RestoreAsync

nextmail threads delete

Delete a thread for good

Scopesthreads:writeNeeds a sign-in
Asks you to confirm
Aliasesrmdelremove

Usage

nextmail threads delete <id> [flags]

Deletes every message in a thread, with its attachments, which is what Delete from Bin does in the app. It cannot be undone.

It works on a thread in any folder, so call trash instead when you only mean to throw the thread away: a trashed thread stays readable and restore brings it back.

Arguments

<id>Required

Thread id.

Examples

nextmail threads delete CAHk7pQ2x9LmZ4-mail.example.com
Skip the confirmation, for scripts
nextmail threads delete CAHk7pQ2x9LmZ4-mail.example.com --yes

Also available in

API
DELETE /threads/{id}
TypeScript
nextmail.threads.delete()
Python
threads.delete()
Ruby
threads.delete
PHP
threads->delete
Go
Threads.Delete
Java
threads().delete
C#
Threads.DeleteAsync

nextmail threads unsubscribe

Unsubscribe from the sender of a thread

Scopesthreads:writeNeeds a sign-in
Asks you to confirm

Usage

nextmail threads unsubscribe <id> [flags]

Does what the Unsubscribe button of the reading pane does: finds the subscription behind the newest message of the thread that carries a List-Unsubscribe header and unsubscribes from it the way the sender asks for, with a one-click request or an unsubscribe email. A sender that only offers a page cannot be unsubscribed by a program, so method is link and url is the page a person has to open.

A thread with no unsubscribe header is a 422 unsubscribe_unsupported, and a thread delivered to no address the key covers is a 404.

Arguments

<id>Required

Thread id.

Examples

nextmail threads unsubscribe CAHk7pQ2x9LmZ4-mail.example.com
Skip the confirmation, for scripts
nextmail threads unsubscribe CAHk7pQ2x9LmZ4-mail.example.com --yes

Also available in

API
POST /threads/{id}/unsubscribe
TypeScript
nextmail.threads.unsubscribe()
Python
threads.unsubscribe()
Ruby
threads.unsubscribe
PHP
threads->unsubscribe
Go
Threads.Unsubscribe
Java
threads().unsubscribe
C#
Threads.UnsubscribeAsync

nextmail threads get-event

Read the event a thread carries

Scopescalendar:readNeeds a sign-in

Usage

nextmail threads get-event <id> [flags]

Returns the calendar event that came with an invitation in the thread, as the invitation card of the reading pane shows it. Answer it with calendar.respondToEvent.

Arguments

<id>Required

Thread id, as threads.list returns it.

Examples

nextmail threads get-event thr_6d1a9c4e2b7f30d85e1c4a92
Print the raw JSON
nextmail threads get-event thr_6d1a9c4e2b7f30d85e1c4a92 --json

Also available in

API
GET /threads/{id}/event
TypeScript
nextmail.threads.getEvent()
Python
threads.get_event()
Ruby
threads.get_event
PHP
threads->getEvent
Go
Threads.GetEvent
Java
threads().getEvent
C#
Threads.GetEventAsync

nextmail threads list-sender-categories

List the senders that always go to one inbox tab

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads list-sender-categories [flags]

Resolves the senders whose mail always goes to one inbox tab, by address. New mail is sorted into Primary, Promotions, Updates, Social or Forums by plain rules, and a choice saved here wins over them. list takes category to read one tab.

The choices belong to the workspace and apply to every address in it. A workspace holds at most 2,000 of them, and they come back as one plain array with no paging.

Examples

nextmail threads list-sender-categories
Print the raw JSON
nextmail threads list-sender-categories --json

Also available in

API
GET /sender-categories
TypeScript
nextmail.threads.listSenderCategories()
Python
threads.list_sender_categories()
Ruby
threads.list_sender_categories
PHP
threads->listSenderCategories
Go
Threads.ListSenderCategories
Java
threads().listSenderCategories
C#
Threads.ListSenderCategoriesAsync

nextmail threads set-sender-category

Always sort a sender into one inbox tab

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads set-sender-category <email> <category> [flags]

Saves the tab for one sender and moves the inbox threads whose newest message is from them, up to the newest 1,000, into it. Mail from them is sorted there from now on, whatever the rules would say. Saving again replaces the choice.

A workspace holds at most 2,000 choices, and the call past that is a 422 sender_category_limit_reached. They apply to every address in the workspace, so a key or an app limited to particular addresses or domains can read them but not change them, and gets a 422 capability_unsupported.

Arguments

<email>Required

The address of the sender, compared without case.

<category>Required

The inbox tab their mail goes to: primary, promotions, updates, social or forums.

Examples

nextmail threads set-sender-category news@example.com promotions
Print the raw JSON
nextmail threads set-sender-category news@example.com promotions --json

Also available in

API
PUT /sender-categories/{email}
TypeScript
nextmail.threads.setSenderCategory()
Python
threads.set_sender_category()
Ruby
threads.set_sender_category
PHP
threads->setSenderCategory
Go
Threads.SetSenderCategory
Java
threads().setSenderCategory
C#
Threads.SetSenderCategoryAsync

nextmail threads clear-sender-category

Remove the tab chosen for a sender

Scopesthreads:writeNeeds a sign-in
Asks you to confirm

Usage

nextmail threads clear-sender-category <email> [flags]

Removes the choice, so new mail from the sender is sorted by the rules again. Threads already sorted stay where they are.

Arguments

<email>Required

The address of the sender, compared without case.

Examples

nextmail threads clear-sender-category news@example.com
Skip the confirmation, for scripts
nextmail threads clear-sender-category news@example.com --yes

Also available in

API
DELETE /sender-categories/{email}
TypeScript
nextmail.threads.clearSenderCategory()
Python
threads.clear_sender_category()
Ruby
threads.clear_sender_category
PHP
threads->clearSenderCategory
Go
Threads.ClearSenderCategory
Java
threads().clearSenderCategory
C#
Threads.ClearSenderCategoryAsync

nextmail threads get-team

Read who has a thread

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads get-team <id> [flags]

Resolves the thread as the team sees it: who it is assigned to, who marked it done, how many comments it has, who else is writing a reply in the app right now, and everyone who can see it.

Only people who can see a thread can be given it or mentioned on it: the workspace owner, members who reach every address, and members who hold its address or its domain. A key acts for the workspace owner.

Arguments

<id>Required

Thread id.

Examples

nextmail threads get-team CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads get-team CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
GET /threads/{id}/team
TypeScript
nextmail.threads.getTeam()
Python
threads.get_team()
Ruby
threads.get_team
PHP
threads->getTeam
Go
Threads.GetTeam
Java
threads().getTeam
C#
Threads.GetTeamAsync

nextmail threads assign

Assign a thread

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads assign <id> <assignee-id> [flags]

Gives the thread to one person, who is emailed unless they assigned it to themselves.

Only people who can see a thread can be given it or mentioned on it: the workspace owner, members who reach every address, and members who hold its address or its domain. A key acts for the workspace owner.

Arguments

<id>Required

Thread id.

<assignee-id>Required

The user id of the person to give it to, as getTeam lists them in team.

Examples

nextmail threads assign CAHk7pQ2x9LmZ4-mail.example.com usr_2f9c1d
Print the raw JSON
nextmail threads assign CAHk7pQ2x9LmZ4-mail.example.com usr_2f9c1d --json

Also available in

API
PUT /threads/{id}/assignee
TypeScript
nextmail.threads.assign()
Python
threads.assign()
Ruby
threads.assign
PHP
threads->assign
Go
Threads.Assign
Java
threads().assign
C#
Threads.AssignAsync

nextmail threads unassign

Unassign a thread

Scopesthreads:writeNeeds a sign-in
Asks you to confirm

Usage

nextmail threads unassign <id> [flags]

Leaves the thread with nobody.

Arguments

<id>Required

Thread id.

Examples

nextmail threads unassign CAHk7pQ2x9LmZ4-mail.example.com
Skip the confirmation, for scripts
nextmail threads unassign CAHk7pQ2x9LmZ4-mail.example.com --yes

Also available in

API
DELETE /threads/{id}/assignee
TypeScript
nextmail.threads.unassign()
Python
threads.unassign()
Ruby
threads.unassign
PHP
threads->unassign
Go
Threads.Unassign
Java
threads().unassign
C#
Threads.UnassignAsync

nextmail threads mark-done

Mark a thread done

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads mark-done <id> [flags]

Archives the thread for everyone and records who marked it done. A new reply brings it back to the inbox, and reopen moves it back by hand.

Arguments

<id>Required

Thread id.

Examples

nextmail threads mark-done CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads mark-done CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
POST /threads/{id}/done
TypeScript
nextmail.threads.markDone()
Python
threads.mark_done()
Ruby
threads.mark_done
PHP
threads->markDone
Go
Threads.MarkDone
Java
threads().markDone
C#
Threads.MarkDoneAsync

nextmail threads reopen

Reopen a thread

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads reopen <id> [flags]

Moves a done thread back to the inbox for everyone.

Arguments

<id>Required

Thread id.

Examples

nextmail threads reopen CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads reopen CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
POST /threads/{id}/reopen
TypeScript
nextmail.threads.reopen()
Python
threads.reopen()
Ruby
threads.reopen
PHP
threads->reopen
Go
Threads.Reopen
Java
threads().reopen
C#
Threads.ReopenAsync

nextmail threads list-comments

List the comments on a thread

Scopesthreads:readNeeds a sign-in

Usage

nextmail threads list-comments <id> [flags]

Resolves the team comments on one thread, oldest first. Everyone who can see the thread reads them, and the sender never does.

Arguments

<id>Required

Thread id.

Examples

nextmail threads list-comments CAHk7pQ2x9LmZ4-mail.example.com
Print the raw JSON
nextmail threads list-comments CAHk7pQ2x9LmZ4-mail.example.com --json

Also available in

API
GET /threads/{id}/comments
TypeScript
nextmail.threads.listComments()
Python
threads.list_comments()
Ruby
threads.list_comments
PHP
threads->listComments
Go
Threads.ListComments
Java
threads().listComments
C#
Threads.ListCommentsAsync

nextmail threads create-comment

Comment on a thread

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads create-comment <id> --body <value> [flags]
nextmail threads create-comment <id> --data <json|@file|-> [flags]

Adds a comment for the team. Everybody in mentions is emailed.

Only people who can see a thread can be given it or mentioned on it: the workspace owner, members who reach every address, and members who hold its address or its domain. A key acts for the workspace owner.

Arguments

<id>Required

Thread id.

Flags

--body <value>

What the comment says, up to 10,000 characters. Leading and trailing spaces are trimmed. Required, here or in --data.

--mentions <a,b>Repeatable

The user ids of people to mention, at most 20. Each has to be able to see the thread.

Default[]
--data <json|@file|->

The whole body as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Examples

The required values only
nextmail threads create-comment CAHk7pQ2x9LmZ4-mail.example.com --body 'Can you take this one?'
With optional flags
nextmail threads create-comment CAHk7pQ2x9LmZ4-mail.example.com --body 'Can you take this one?' --mentions usr_2f9c1d
Read the whole body from a JSON file
nextmail threads create-comment CAHk7pQ2x9LmZ4-mail.example.com --data @thread.json

Also available in

API
POST /threads/{id}/comments
TypeScript
nextmail.threads.createComment()
Python
threads.create_comment()
Ruby
threads.create_comment
PHP
threads->createComment
Go
Threads.CreateComment
Java
threads().createComment
C#
Threads.CreateCommentAsync

nextmail threads update-comment

Change a comment

Scopesthreads:writeNeeds a sign-in

Usage

nextmail threads update-comment <id> <comment-id> --body <value> [flags]
nextmail threads update-comment <id> <comment-id> --data <json|@file|-> [flags]

Replaces the text and the mentions of a comment. Only its author can change it, and anybody newly mentioned is emailed.

Arguments

<id>Required

Thread id.

<comment-id>Required

The comment id, as listComments returns it.

Flags

--body <value>

The new text, up to 10,000 characters. Required, here or in --data.

--mentions <a,b>Repeatable

The user ids it mentions now, at most 20. Leave it out to mention nobody.

Default[]
--data <json|@file|->

The whole body as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Examples

nextmail threads update-comment CAHk7pQ2x9LmZ4-mail.example.com tcm_8a1f --body 'Done, sent the quote.'
Read the whole body from a JSON file
nextmail threads update-comment CAHk7pQ2x9LmZ4-mail.example.com tcm_8a1f --data @thread.json

Also available in

API
PATCH /threads/{id}/comments/{commentId}
TypeScript
nextmail.threads.updateComment()
Python
threads.update_comment()
Ruby
threads.update_comment
PHP
threads->updateComment
Go
Threads.UpdateComment
Java
threads().updateComment
C#
Threads.UpdateCommentAsync

nextmail threads delete-comment

Delete a comment

Scopesthreads:writeNeeds a sign-in
Asks you to confirm

Usage

nextmail threads delete-comment <id> <comment-id> [flags]

Deletes a comment for good. Its author can delete it, and so can the workspace owner, which a key acts for.

Arguments

<id>Required

Thread id.

<comment-id>Required

The comment id, as listComments returns it.

Examples

nextmail threads delete-comment CAHk7pQ2x9LmZ4-mail.example.com tcm_8a1f
Skip the confirmation, for scripts
nextmail threads delete-comment CAHk7pQ2x9LmZ4-mail.example.com tcm_8a1f --yes

Also available in

API
DELETE /threads/{id}/comments/{commentId}
TypeScript
nextmail.threads.deleteComment()
Python
threads.delete_comment()
Ruby
threads.delete_comment
PHP
threads->deleteComment
Go
Threads.DeleteComment
Java
threads().deleteComment
C#
Threads.DeleteCommentAsync