App Logo
mail.google.com

Archive Gmail thread

Archive a Gmail thread by its hex threadId (removes it from the Inbox; it stays in All Mail). Returns archived, threadId, and the Inbox page it was found on. Acts on the thread's row in the Inbox list, scanning the first 4 Inbox pages (~200 newest threads), and confirms the row actually left the list rather than trusting a toast. If the thread is not in those pages it throws: it is then already archived (nothing to do) or older than that. It never acts from the conversation view, where Gmail's Archive control is offered whatever the thread's state and so cannot confirm anything.

Input

threadId required

Hex legacy thread id (as returned by search_emails).

account optional

Google account email to act as (authuser=). Without it Gmail picks u/0, nondeterministic in a multi-account browser jar.

Output

archived required
threadId required
page optional

Which Inbox page the thread was found on (1-based), or null when it was located through search instead.

already_archived optional

true = the thread was already out of the Inbox; nothing was clicked.

Start building not clicking