sync_emails
Incrementally import IMAP email metadata into the local SQLite search index, using checkpoints to avoid re-fetching; set full:true to prune moved, archived, or trashed messages.
Instructions
Incrementally sync email metadata from IMAP into the local SQLite index, using stored checkpoints to avoid re-fetching already-indexed messages. Use before calling search_indexed_emails or get_threads when the index may be stale. The default incremental sync only ever adds/updates recent messages — it never notices a message that was archived, trashed, or moved out of the synced folder by any client, so search/thread/digest tools can keep showing a message as still present indefinitely. Set full:true (per folder — sync each folder you want cleaned up) to also detect and prune those, in addition to fetching a larger sample. Prefer run_background_sync to trigger the scheduled sync cycle (also incremental-only by default; see PROTONMAIL_AUTO_SYNC_FULL).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| full | No | Fetch a larger per-folder sample, and detect/prune messages no longer present in this folder (moved, archived, trashed, or deleted by any client) that the default incremental sync would otherwise leave stale in the index forever. | |
| folder | No | Folder to sync. Defaults to all folders. | |
| limitPerFolder | No | Override the per-folder fetch limit. | |
| timeBudgetSeconds | No | Wall-clock budget for a per-call sync (default 45, max 300). Each folder is committed to the index as soon as it is fetched; when the budget is reached no further folder is started and the response reports complete:false with remainingFolders. Call again to continue (least-recently-synced folders go first). | |
| includeAttachmentText | No | Extract searchable text from text-like attachments while syncing. |