batch_modify_labels
Add and/or remove the same labels on many email messages at once in a single Gmail API call (wraps users.messages.batchModify). Use this for bulk operations such as marking multiple specific emails as read (remove ['UNREAD']), archiving (remove ['INBOX']), or starring (add ['STARRED']). Use list_labels to find label IDs (Gmail requires IDs, not names). Common system label IDs: INBOX, STARRED, IMPORTANT, UNREAD, SPAM, TRASH. Provide 1-1000 email IDs and at least one of add or remove. The same label changes are applied to every listed message. Gmail returns no per-message status, so a successful call means Gmail accepted the request; an invalid email ID or label ID typically causes Gmail to reject it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| add | No | Label IDs to add to every message (e.g., ['STARRED', 'Label_123']) | |
| remove | No | Label IDs to remove from every message (e.g., ['UNREAD', 'INBOX']) | |
| emailIds | Yes | Email IDs to modify (1-1000, from search_email or get_email) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | ||
| addedLabels | Yes | ||
| acceptedCount | Yes | Number of (deduplicated) message IDs the batch request was accepted for. Gmail returns no per-message status, so this is not necessarily the number of messages whose labels actually changed. | |
| removedLabels | Yes |