Google: Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings)
Google gmailUsersSettingsFilters.gmailUsersSettingsFiltersGet: arguments, response, policy and SDK examples.
← Gmail users settings filters operations · Get started
Operation google.gmail_users_settings_filters_get
Provider route: GET /gmail/v1/users/{userId}/settings/filters/{id}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/google with npm, or alter-sdk-google with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { GoogleIntegration } from "@alter-ai/google";
async function execute(input: Parameters<GoogleIntegration["gmailUsersSettingsFilters"]["gmailUsersSettingsFiltersGet"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new GoogleIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.gmailUsersSettingsFilters.gmailUsersSettingsFiltersGet(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_google import GoogleIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = GoogleIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.gmail_users_settings_filters.gmail_users_settings_filters_get(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.id | string | Required within parent | The ID of the filter to be fetched. |
path.userId | string | Required within parent | User’s email address. The special value “me” can be used to indicate the authenticated user. Default: me |
query | object | Optional | Additional keys: not allowed |
query.fields | string | Optional | Selector specifying which fields to include in a partial response. |
query.prettyPrint | boolean | Optional | Returns response with indentations and line breaks. Default: true |
query.quotaUser | string | Optional | Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body |
Referenced models: Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body
Schemas
Section titled “Schemas”Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread. |
action | Model | Optional | Expand Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body — action Action that the filter performs. |
criteria | Model | Optional | Expand Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body — criteria Matching criteria for the filter. |
id | string | Optional | The server assigned ID of the filter. |
Referenced models: Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body — action, 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 — action
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A set of actions to perform on a message. |
addLabelIds | array | Optional | List of labels to add to the message. |
addLabelIds[] | string | Each item | |
forward | string | Optional | Email address that the message should be forwarded to. This effectively redirects the message to the address specified in this field, maintaining the original sender in the "From" field. |
removeLabelIds | array | Optional | List of labels to remove from the message. |
removeLabelIds[] | string | Each item |
Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response 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 | JSON | Optional | |
size (anyOf 1) | integer | Alternative | The size of the entire RFC822 message in bytes, including all headers and attachments. Format: int32 |
size (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
sizeComparison | string | Optional | How the message size in bytes should be in relation to the size field. Known values: 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. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: google.gmail_users_settings_filters_get. Catalog operation: gmail.users.settings.filters.get. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["https://mail.google.com/", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.settings.basic"]