Batch Modify Gmail Message Labels
batch_modify_gmail_message_labelsAdd or remove Gmail labels across many messages or entire conversations, with optional verification of which message IDs changed and per-thread outcomes.
Instructions
Adds or removes labels on many Gmail messages, or on every message of whole conversations via thread_ids.
message_ids are sent in one users.messages.batchModify call (Gmail accepts up to 1000 ids per call). That endpoint returns no per-message result and silently ignores ids it does not recognise, so by default the messages are read back afterwards to report which ids actually changed.
thread_ids are modified one at a time with users.threads.modify, e.g. archive a conversation with remove_label_ids=["INBOX"] or mark it read with remove_label_ids=["UNREAD"]. Each thread reports its own outcome. message_ids and thread_ids can be combined; at least one is required, as is at least one of add_label_ids or remove_label_ids.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| verify | No | Read message_ids back and report per-id outcomes, at the cost of one extra read per id (batched 25 at a time). Set False for very large sweeps where an unverified result is acceptable. Has no effect on thread_ids, which always report per thread. | |
| thread_ids | No | Thread (conversation) IDs to modify. | |
| message_ids | No | Message IDs to modify. | |
| add_label_ids | No | Label IDs to add. | |
| remove_label_ids | No | Label IDs to remove. | |
| user_google_email | Yes | The user's Google email address. Required. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |