Google: Creates a filter Note: you can only create a maximum of 1,000 filters For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — request body — body criteria
Creates a filter. Note: you can only create a maximum of 1,000 filters. For more information, see [Manage Gmail filters](https://developers.google.com/workspace/gmail/api/guides/filter_settings).: request body, field body / criteria. Complete fields and constraints for contract 2026-10-27.
API reference · Contract 2026-10-27
SDK schema: Creates a filter. Note: you can only create a maximum of 1,000 filters For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — request body — body criteria
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Message matching criteria. |
excludeChats | boolean | Optional | Whether the response should exclude chats. |
from | string | Optional | The sender’s display name or email address. |
hasAttachment | boolean | Optional | Whether the message has any attachment. |
negatedQuery | string | Optional | Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `“from:someuser@example.com rfc822msgid: is:unread”`. |
query | string | Optional | Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `“from:someuser@example.com rfc822msgid: is:unread”`. |
size | integer | Optional | The size of the entire RFC822 message in bytes, including all headers and attachments. Format: int32 |
sizeComparison | string | Optional | How the message size in bytes should be in relation to the size field. One of: unspecified, smaller, larger |
subject | string | Optional | Case-insensitive phrase found in the message’s subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed. |
to | string | Optional | The recipient’s display name or email address. Includes recipients in the “to”, “cc”, and “bcc” header fields. You can use simply the local part of the email address. For example, “example” and “example@” both match “example@example.com”. This field is case-insensitive. |