/gmail/v1/users/{userId}/settings/filters
POST
/gmail/v1/users/{userId}/settings/filtersCreates a filter. Note: you can only create a maximum of 1,000 filters.
Request
User's email address. The special value "me" can be used to indicate the authenticated user.
Action that the filter performs.
List of labels to add to the message.
Email address that the message should be forwarded to.
List of labels to remove from the message.
Matching criteria for the filter.
Whether the response should exclude chats.
The sender's display name or email address.
Whether the message has any attachment.
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"
.
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"
.
The size of the entire RFC822 message in bytes, including all headers and attachments.
How the message size in bytes should be in relation to the size field.
Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
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@gmail.com". This field is case-insensitive.
The server assigned ID of the filter.
{
"action": {
"addLabelIds": [
"string"
],
"forward": "string",
"removeLabelIds": [
"string"
]
},
"criteria": {
"excludeChats": true,
"from": "string",
"hasAttachment": true,
"negatedQuery": "string",
"query": "string",
"size": 0,
"sizeComparison": "unspecified",
"subject": "string",
"to": "string"
},
"id": "string"
}
Request samples
Responses
Action that the filter performs.
List of labels to add to the message.
Email address that the message should be forwarded to.
List of labels to remove from the message.
Matching criteria for the filter.
Whether the response should exclude chats.
The sender's display name or email address.
Whether the message has any attachment.
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"
.
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"
.
The size of the entire RFC822 message in bytes, including all headers and attachments.
How the message size in bytes should be in relation to the size field.
Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
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@gmail.com". This field is case-insensitive.
The server assigned ID of the filter.
{
"action": {
"addLabelIds": [
"string"
],
"forward": "string",
"removeLabelIds": [
"string"
]
},
"criteria": {
"excludeChats": true,
"from": "string",
"hasAttachment": true,
"negatedQuery": "string",
"query": "string",
"size": 0,
"sizeComparison": "unspecified",
"subject": "string",
"to": "string"
},
"id": "string"
}