Skip to content

Google: Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body — criteria

Gets a filter. For more information, see [Manage Gmail filters](https://developers.google.com/workspace/gmail/api/guides/filter_settings).: response body, field criteria. Complete fields and constraints for contract 2026-10-27.

API reference · Contract 2026-10-27

SDK schema: Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body — criteria

FieldTypePresenceDescription and constraints
$objectRootMessage matching criteria.
excludeChatsbooleanOptionalWhether the response should exclude chats.
fromstringOptionalThe sender’s display name or email address.
hasAttachmentbooleanOptionalWhether the message has any attachment.
negatedQuerystringOptionalOnly 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”`.
querystringOptionalOnly 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”`.
sizeJSONOptional
size (anyOf 1)integerAlternativeThe size of the entire RFC822 message in bytes, including all headers and attachments.
Format: int32
size (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
sizeComparisonstringOptionalHow the message size in bytes should be in relation to the size field.
Known values: unspecified, smaller, larger
subjectstringOptionalCase-insensitive phrase found in the message’s subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
tostringOptionalThe 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.

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.