Search messages across all mailboxes
GET/api/search
Searches every mailbox of the user in turn with IMAP SEARCH and streams the results as they are found, as newline-delimited JSON (application/x-ndjson). Events match GET /api/accounts/{accountId}/search (start, progress, indexing, matches, done, error, folder-skipped) and each one additionally carries accountId and accountEmail to identify the mailbox; in matches events every message is tagged with accountId and accountEmail as well, so each result can be addressed in its own mailbox. start has totalAccounts instead of totalFolders, and done has the combined total and failedAccounts.
The same criteria apply as for a single account, but folder (in:) is resolved separately in each mailbox; mailboxes without that folder are skipped. The limit is shared across mailboxes: search stops once that many messages have been found, so results reflect the newest matches per folder rather than a strict global order. A mailbox that fails (connection or login error) is reported as an { "type": "account-error", "accountId", "accountEmail", "error" } line and the remaining mailboxes are still searched.
With accountId, only that mailbox is searched; an unknown id returns 404.
Request
Responses
- 200
- 400
- 401
- 404
Newline-delimited search events for every mailbox.
Request failed.
The session has no mailbox access token. code is mail_token_missing; sign in again.
The account does not exist or belongs to another user.