Users.settings.filters

For a list of methods for this resource, see the end of this page.

Resource representations

Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.

{
  "id": string,
  "criteria": {
    "from": string,
    "to": string,
    "subject": string,
    "query": string,
    "negatedQuery": string,
    "hasAttachment": boolean,
    "excludeChats": boolean,
    "size": integer,
    "sizeComparison": string
  },
  "action": {
    "addLabelIds": [
      string
    ],
    "removeLabelIds": [
      string
    ],
    "forward": string
  }
}
Property name Value Description Notes
action nested object Action that the filter performs.
action.addLabelIds[] list List of labels to add to the message.
action.forward string Email address that the message should be forwarded to.
action.removeLabelIds[] list List of labels to remove from the message.
criteria nested object Matching criteria for the filter.
criteria.excludeChats boolean Whether the response should exclude chats.
criteria.from string The sender's display name or email address.
criteria.hasAttachment boolean Whether the message has any attachment.
criteria.negatedQuery string 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".
criteria.query string 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".
criteria.size integer The size of the entire RFC822 message in bytes, including all headers and attachments.
criteria.sizeComparison string How the message size in bytes should be in relation to the size field.

Acceptable values are:
  • "larger"
  • "smaller"
  • "unspecified"
criteria.subject string Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
criteria.to string 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.
id string The server assigned ID of the filter.

Methods

create
Creates a filter.
delete
Deletes a filter.
get
Gets a filter.
list
Lists the message filters of a Gmail user.

フィードバックを送信...

ご不明な点がありましたら、Google のサポートページをご覧ください。