Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.idstringRequired within parentThe ID of the filter to be fetched.
path.userIdstringRequired within parentUser’s email address. The special value “me” can be used to indicate the authenticated user.
Default: me
queryobjectOptionalAdditional keys: not allowed
query.fieldsstringOptionalSelector specifying which fields to include in a partial response.
query.prettyPrintbooleanOptionalReturns response with indentations and line breaks.
Default: true
query.quotaUserstringOptionalAvailable 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 media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand 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

Gets a filter For more information, see Manage Gmail filters (https: developers google com workspace gmail api guides filter settings) — response body
FieldTypePresenceDescription and constraints
$objectRootResource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
actionModelOptionalExpand 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.
criteriaModelOptionalExpand 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.
idstringOptionalThe 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
FieldTypePresenceDescription and constraints
$objectRootA set of actions to perform on a message.
addLabelIdsarrayOptionalList of labels to add to the message.
addLabelIds[]stringEach item
forwardstringOptionalEmail 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.
removeLabelIdsarrayOptionalList of labels to remove from the message.
removeLabelIds[]stringEach item
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.

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"]

Official provider source

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.