- Category: email
- Auth: OAUTH2
- Composio-managed OAuth available? Yes
- Tools: 63
- Triggers: 2
- Slug:
GMAIL - Version: 20261103_00
Frequently Asked Questions
How do I set up custom Google OAuth credentials for Gmail?
How do I set up custom Google OAuth credentials for Gmail?
Why am I seeing "App is blocked" when connecting Gmail?
Why am I seeing "App is blocked" when connecting Gmail?
Why am I getting "Gmail API has not been used in project" error?
Why am I getting "Gmail API has not been used in project" error?
Why am I getting "Error 400: invalid_scope"?
Why am I getting "Error 400: invalid_scope"?
Why does the OAuth consent screen show "Composio" instead of my app?
Why does the OAuth consent screen show "Composio" instead of my app?
Why am I getting 401 errors on tool calls?
Why am I getting 401 errors on tool calls?
Why is my Gmail trigger slow?
Why is my Gmail trigger slow?
Why am I getting "Quota Exhausted" or "rate limit exhausted"?
Why am I getting "Quota Exhausted" or "rate limit exhausted"?
How do I send an email with an attachment?
How do I send an email with an attachment?
- Connect Gmail for your user, then create a session for the same user and give your agent the session tools.
- Upload
./report.pdfto that session with the experimentalsession.experimental.filesAPI. See sandbox files and mounts for Python, TypeScript, and API examples. The agent can read the uploaded file in the remote sandbox, not from your application’s local filesystem. - Ask the agent to send the email with your recipient, subject, body, and the uploaded file’s sandbox path. For a file mounted at
/mnt/files/report.pdf, instruct it to use the sandbox’sget_mount_file_s3_key("report.pdf")helper and pass the returned key to the discovered email tool in a file object withname,mimetype, ands3key. A sandbox path is not a storage key. See session files and toolkit attachments. - Check the tool result before reporting that the email was sent. If the tool fails, report the error.
Why can Gmail filter setup show an app-blocked error?
Why can Gmail filter setup show an app-blocked error?
gmail.settings.basic, use your own Google OAuth app verified for https://www.googleapis.com/auth/gmail.settings.basic, then reconnect.When should I avoid gmail.metadata when fetching full Gmail email content?
When should I avoid gmail.metadata when fetching full Gmail email content?
https://www.googleapis.com/auth/gmail.metadata only when the app needs message metadata such as labels and headers, not message bodies or payload content. Gmail treats gmail.metadata as a restricted metadata-only scope, and it is not compatible with broader content-access scopes such as gmail.readonly, gmail.modify, or mail.google.com in the same OAuth request.If a tool needs full email content, remove gmail.metadata from the auth config and request a Gmail scope that allows message content access. Then reconnect the account so the new scope set is granted.Tools
Modify email labels
Modify email labels
GMAIL_ADD_LABEL_TO_EMAILAdds and/or removes specified Gmail labels for a message; ensure message_id and all label_ids are valid (use ‘listLabels’ for custom label IDs).Input Parameters
Output
Batch delete Gmail messages
Batch delete Gmail messages
GMAIL_BATCH_DELETE_MESSAGESPermanently deletes multiple Gmail messages by ID, bypassing Trash. A successful request does not confirm individual messages existed or were deleted.Input Parameters
Output
Batch modify Gmail messages
Batch modify Gmail messages
GMAIL_BATCH_MODIFY_MESSAGESAdds or removes labels on up to 1,000 Gmail messages in one request, supporting operations such as archiving and marking messages read or unread. A successful response confirms request acceptance, not individual message status.Input Parameters
Output
Create email draft
Create email draft
GMAIL_CREATE_EMAIL_DRAFTCreates a Gmail draft with optional recipients, subject, plain or HTML body, attachments, and threading. When a requested thread cannot be fetched, the draft is created without threading; a provided subject is used instead of the thread subject.Input Parameters
is_html must be True if HTML. Optional - drafts can be created without a body and edited later before sending. Can also be provided as ‘message_body’.body is already formatted HTML. When False, plain text newlines are auto-converted to tags. Both modes result in HTML email; this flag controls whether the body content is treated as raw HTML or plain text that gets HTML formatting applied.
Output
Create Gmail filter
Create Gmail filter
GMAIL_CREATE_FILTERTool to create a new Gmail filter with specified criteria and actions. Use when the user wants to automatically organize incoming messages based on sender, subject, size, or other criteria. Note: you can only create a maximum of 1,000 filters per account.Input Parameters
Output
Create label
Create label
GMAIL_CREATE_LABELCreates a Gmail label and returns its label ID. For nested labels, it may create missing parent labels; on a name conflict it attempts to return the existing matching label.Input Parameters
Output
Delete Draft
Delete Draft
GMAIL_DELETE_DRAFTPermanently deletes a specific Gmail draft using its ID with no recovery possible; verify the correct draft_id and obtain explicit user confirmation before calling. Ensure the draft exists and the user has necessary permissions for the given user_id.Input Parameters
Output
Delete Gmail filter
Delete Gmail filter
Delete label from account (permanent)
Delete label from account (permanent)
GMAIL_DELETE_LABELPermanently DELETES a user-created Gmail label from the account (not from a message). WARNING: This action DELETES the label definition itself, removing it from all messages. System labels (INBOX, SENT, UNREAD, etc.) cannot be deleted. To add/remove labels from specific messages, use GMAIL_ADD_LABEL_TO_EMAIL action instead.Input Parameters
Output
Delete message
Delete message
Delete thread
Delete thread
Fetch emails
Fetch emails
GMAIL_FETCH_EMAILSLists Gmail messages with query and label filtering, pagination, and optional message details. Individual detail fetches returning 404, 429, or 503 are skipped, so a page can contain fewer messages than the list result.Input Parameters
nextPageToken. Must be a valid opaque token string from a previous API response. Do not pass arbitrary values. Omit for the first page. Loop calls using nextPageToken until it is absent to avoid silently missing messages. resultSizeEstimate is approximate — do not use as a stopping condition.Output
Fetch message by message ID
Fetch message by message ID
GMAIL_FETCH_MESSAGE_BY_MESSAGE_IDFetches a Gmail message by its message ID in the requested format and returns formatted message details. Available fields depend on the format.Input Parameters
threadId (use GMAIL_FETCH_MESSAGE_BY_THREAD_ID for threads), the Message-ID email header, or any fabricated value — only IDs from Gmail API list/search responses.Output
Fetch Message by Thread ID
Fetch Message by Thread ID
GMAIL_FETCH_MESSAGE_BY_THREAD_IDRetrieves messages from an accessible Gmail thread by thread ID, returning thread details and a messages array. Message order is not guaranteed; use messageTimestamp to identify oldest or newest messages and labelIds to filter drafts.Input Parameters
nextPageToken until it is absent; stopping early will miss messages in long threads.Output
Forward email message
Forward email message
GMAIL_FORWARD_MESSAGEForwards an existing Gmail message to specified recipients, with optional additional text. The tool copies original message parts into a new message, but may alter MIME structure and attachment metadata.Input Parameters
Output
Get Gmail attachment
Get Gmail attachment
GMAIL_GET_ATTACHMENTRetrieves a Gmail message attachment by message and attachment IDs and returns a downloadable file using the supplied filename.Input Parameters
Output
Get Auto-Forwarding Settings
Get Auto-Forwarding Settings
GMAIL_GET_AUTO_FORWARDINGTool to get the auto-forwarding setting for the specified account. Use when you need to retrieve the current auto-forwarding configuration including enabled status, forwarding email address, and message disposition.Input Parameters
Output
Get contacts
Get contacts
GMAIL_GET_CONTACTSLists saved Google contacts with selectable fields and pagination, optionally including Other Contacts. Other Contacts are fetched on the first page; endpoint failures can result in partial results, and contact records may be sparse.Input Parameters
nextPageToken until it is absent — stopping early silently omits contacts.person_fields is restricted to emailAddresses, names, phoneNumbers, and metadata only — requesting other fields (e.g., organizations, birthdays) causes validation errors or silent omissions.Output
Get Draft
Get Draft
GMAIL_GET_DRAFTRetrieves a single Gmail draft by its ID. Use this to fetch and inspect draft content before sending via GMAIL_SEND_DRAFT. The format parameter controls the level of detail returned.Input Parameters
me can be used to indicate the authenticated user.Output
Get Gmail filter
Get Gmail filter
Get label details
Get label details
GMAIL_GET_LABELGets details for a specified Gmail label. Use this to retrieve label information including name, type, visibility settings, message/thread counts, and color.Input Parameters
Output
Get Language Settings
Get Language Settings
GMAIL_GET_LANGUAGE_SETTINGSTool to retrieve the language settings for a Gmail user. Use when you need to determine the display language preference for the authenticated user or a specific Gmail account.Input Parameters
Output
Get People
Get People
GMAIL_GET_PEOPLERetrieves a person’s details by resource name or lists the authenticated user’s Other Contacts, using a field mask to select the information returned. Other Contacts can be paginated and queried using a sync token for changes since a previous sync.Input Parameters
other_contacts is true.other_contacts is true.other_contacts is true and paginating.other_contacts is true.other_contacts is true, only a restricted subset is valid (emailAddresses, names, phoneNumbers, metadata); extended fields like organizations or birthdays may cause validation errors or silent omissions in that mode.other_contacts is false. Deleted or stale resource_names may return partial records with missing emailAddresses, names, or other fields.resource_name and enabling pagination/sync. If false, retrieves information for the single person specified by resource_name.Output
Get Profile
Get Profile
GMAIL_GET_PROFILERetrieves Gmail profile information (email address, aggregate messagesTotal/threadsTotal, historyId) for a user. messagesTotal counts individual emails; threadsTotal counts conversations; neither is per-label — use GMAIL_FETCH_EMAILS with label filters for label-specific counts. The returned historyId seeds incremental sync via GMAIL_LIST_HISTORY; if historyIdTooOld is returned, rescan with GMAIL_FETCH_EMAILS before resuming. Response may be wrapped under a top-level data field; unwrap before reading fields. A successful call confirms mailbox connectivity but not full mailbox access if granted scopes are narrow. Use the returned email address to dynamically identify the authenticated account rather than hard-coding it.Input Parameters
Output
Get Vacation Settings
Get Vacation Settings
GMAIL_GET_VACATION_SETTINGSTool to retrieve vacation responder settings for a Gmail user. Use when you need to check if out-of-office auto-replies are configured and view their content.Input Parameters
Output
Import message
Import message
GMAIL_IMPORT_MESSAGETool to import a message into the user’s mailbox with standard email delivery scanning and classification. Use when you need to add an existing email to a Gmail account without sending it through SMTP. This method doesn’t perform SPF checks, so it might not work for some spam messages.Input Parameters
Output
Insert message into mailbox
Insert message into mailbox
GMAIL_INSERT_MESSAGETool to insert a message into the user’s mailbox similar to IMAP APPEND. Use when you need to add an email directly to a mailbox bypassing most scanning and classification. This does not send a message.Input Parameters
Output
List CSE identities
List CSE identities
GMAIL_LIST_CSE_IDENTITIESLists a page of client-side encrypted identities and their key-pair associations. A response indicating that CSE is not enabled is returned as an empty list.Input Parameters
Output
List CSE key pairs
List CSE key pairs
GMAIL_LIST_CSE_KEYPAIRSLists a page of client-side encryption key pairs, including public keys and enablement states. A response indicating that CSE is not enabled is returned as an empty list.Input Parameters
Output
List Drafts
List Drafts
GMAIL_LIST_DRAFTSRetrieves a paginated list of email drafts from a user’s Gmail account. Use verbose=true to get full draft details including subject, body, sender, and timestamp. Draft ordering is non-guaranteed; iterate using page_token until it is absent to retrieve all drafts. Newly created drafts may not appear immediately. Rapid calls may trigger 403 userRateLimitExceeded or 429 errors; apply exponential backoff (1s, 2s, 4s) before retrying.Input Parameters
Output
List Gmail filters
List Gmail filters
GMAIL_LIST_FILTERSTool to list all Gmail filters (rules) in the mailbox. Use for security audits to detect malicious filter rules or before creating new filters to avoid duplicates.Input Parameters
Output
List forwarding addresses
List forwarding addresses
GMAIL_LIST_FORWARDING_ADDRESSESTool to list all forwarding addresses for the specified Gmail account. Use when you need to retrieve the email addresses that are allowed to be used for forwarding messages.Input Parameters
Output
List Gmail history
List Gmail history
GMAIL_LIST_HISTORYLists Gmail mailbox change history since a known history ID for incremental sync, with optional label and history-type filters and pagination. An empty history list means no records matched the request, not necessarily that no mailbox changes occurred.Input Parameters
Output
List Gmail labels
List Gmail labels
GMAIL_LIST_LABELSRetrieves all system and user-created labels for a Gmail account in a single unpaginated response. Primary use: obtain internal label IDs (e.g., ‘Label_123’) required by other Gmail tools — display names cannot be used as label identifiers and cause silent failures or errors. System labels (INBOX, UNREAD, SPAM, TRASH, etc.) are case-sensitive and must be used exactly as returned; INBOX, SPAM, and TRASH are read-only and cannot be added/removed via label modification tools. The Gmail search ‘label:’ operator accepts display names, but label_ids parameters in tools like GMAIL_FETCH_EMAILS require internal IDs from this tool — mixing conventions yields zero results silently. Do not hardcode label IDs across sessions; refresh via this tool on conflict errors.Input Parameters
Output
List Gmail messages (Deprecated)
List Gmail messages (Deprecated)
GMAIL_LIST_MESSAGESDEPRECATED: Use GMAIL_FETCH_EMAILS instead. Lists the messages in the user’s mailbox. Use when you need to retrieve a list of email messages with optional filtering by labels or search query.Input Parameters
Output
List send-as aliases
List send-as aliases
GMAIL_LIST_SEND_ASLists the send-as aliases for a Gmail account, including the primary address and custom ‘from’ aliases. Use when you need to retrieve available sending addresses for composing emails.Input Parameters
Output
List S/MIME configs
List S/MIME configs
GMAIL_LIST_SMIME_INFOLists S/MIME certificate configurations for a specified Gmail send-as alias. If Gmail reports that the feature is not enabled, returns an empty list with S/MIME marked disabled.Input Parameters
Output
List threads
List threads
GMAIL_LIST_THREADSRetrieves a list of email threads from a Gmail account, identified by user_id (email address or ‘me’), supporting filtering and pagination. Spam and trash are excluded by default unless explicitly targeted via label:spam or label:trash in the query.Input Parameters
from:, to:, subject:, label:, is:unread, has:attachment, after:, before:. Dates must use YYYY/MM/DD format; date operators are UTC-based. Exact subject phrases require quotes (e.g., subject:'meeting notes').verbose=true with large max_results produces very large responses; keep max_results modest when verbose is enabled.nextPageToken via page_token until absent.Output
Modify thread labels
Modify thread labels
GMAIL_MODIFY_THREAD_LABELSAdds or removes specified existing label IDs from a Gmail thread, affecting all its messages; ensure the thread ID is valid. To modify a single message only, use a message-level tool instead.Input Parameters
Output
Trash thread
Trash thread
GMAIL_MOVE_THREAD_TO_TRASHMoves the specified thread to the trash. Any messages that belong to the thread are also moved to the trash.Input Parameters
Output
Move to Trash
Move to Trash
GMAIL_MOVE_TO_TRASHMoves an existing, non-deleted email message to the trash for the specified user. Trashed messages are recoverable and still count toward storage quota until purged. Prefer this over GMAIL_BATCH_DELETE_MESSAGES when recovery may be needed. For bulk operations, use GMAIL_BATCH_MODIFY_MESSAGES or GMAIL_BATCH_DELETE_MESSAGES instead of repeated calls to this tool.Input Parameters
Output
Patch Label
Patch Label
GMAIL_PATCH_LABELPatches the specified user-created label. System labels (e.g., INBOX, SENT, SPAM) cannot be modified and will be rejected.Input Parameters
,, /, or ..type set to user. At least one of ‘name’, ‘messageListVisibility’, ‘labelListVisibility’, or ‘color’ must be provided. Must include both backgroundColor and textColor subfields; both values must come from Gmail’s predefined color palette — arbitrary hex values or omitting either field causes a 400 error.me can be used to indicate the authenticated user.Output
Patch send-as alias
Patch send-as alias
GMAIL_PATCH_SEND_ASPatches a Gmail send-as alias, including its display name, reply-to address, signature, default status, or SMTP configuration. This tool declares support for service-account OAuth, not standard OAuth.Input Parameters
Output
Remove label (Deprecated)
Remove label (Deprecated)
Search People
Search People
GMAIL_SEARCH_PEOPLESearches saved contacts and optionally Other Contacts by query, returning matching person records. When both sources are requested, results may be partial if one search fails.Input Parameters
Output
Send Draft
Send Draft
GMAIL_SEND_DRAFTSends an existing Gmail draft immediately to the recipients already in its To, Cc, and Bcc headers. The draft’s recipients and content cannot be changed by this action; confirm them before sending.Input Parameters
me can be used to indicate the authenticated user.Output
Send Email
Send Email
GMAIL_SEND_EMAILSends an email immediately through Gmail to specified To, Cc, or Bcc recipients, with a subject or body and optional attachments. Supports plain text or HTML and may append the configured Gmail signature; attachments are limited to 20 MiB in total before encoding.Input Parameters
is_html must be True.Output
Get IMAP Settings
Get IMAP Settings
Get POP settings
Get POP settings
GMAIL_SETTINGS_GET_POPTool to retrieve POP settings for a Gmail account. Use when you need to check the current POP configuration including access window and message disposition.Input Parameters
Output
Get send-as alias
Get send-as alias
GMAIL_SETTINGS_SEND_AS_GETTool to retrieve a specific send-as alias configuration for a Gmail user. Use when you need to get details about a send-as email address including display name, signature, SMTP settings, and verification status. Fails with HTTP 404 if the specified address is not a member of the send-as collection.Input Parameters
Output
Stop watch notifications
Stop watch notifications
Untrash Message
Untrash Message
GMAIL_UNTRASH_MESSAGETool to remove a message from trash in Gmail. Use when you need to restore a previously trashed email message.Input Parameters
Output
Untrash thread
Untrash thread
Update Google Contact
Update Google Contact
GMAIL_UPDATE_CONTACTReplace selected fields on an existing saved Google contact.Input Parameters
Output
Update draft
Update draft
GMAIL_UPDATE_DRAFTUpdates a Gmail draft by ID by replacing its message. The tool reads the existing draft to preserve omitted recipients, subject and body where applicable, but existing attachments are not preserved unless supplied again.Input Parameters
tags.
Output
Update IMAP settings
Update IMAP settings
GMAIL_UPDATE_IMAP_SETTINGSTool to update IMAP settings for a Gmail account. Use when you need to modify IMAP configuration such as enabling/disabling IMAP, setting auto-expunge behavior, or configuring folder size limits.Input Parameters
Output
Update Label
Update Label
GMAIL_UPDATE_LABELUpdates an existing Gmail label’s name, visibility settings, or color to help organize the mailbox. Color is available for user labels and requires both a background and text color from Gmail’s supported palette.Input Parameters
me can be used to indicate the authenticated user.Output
Update Language Settings
Update Language Settings
GMAIL_UPDATE_LANGUAGE_SETTINGSTool to update the language settings for a Gmail user. Use when you need to change the display language preference for the authenticated user or a specific Gmail account. The returned displayLanguage may differ from the requested value if Gmail selects a close variant.Input Parameters
Output
Update POP settings
Update POP settings
GMAIL_UPDATE_POP_SETTINGSTool to update POP settings for a Gmail account. Use when you need to configure POP access window or message disposition behavior.Input Parameters
Output
Update send-as alias
Update send-as alias
GMAIL_UPDATE_SEND_ASUpdates a Gmail send-as alias, including its display name, signature, reply-to address, or SMTP settings; Gmail sanitizes HTML signatures before saving. The tool declares support for service-account OAuth, not standard OAuth; non-primary addresses require domain-wide delegation.Input Parameters
Output
Update Vacation Settings
Update Vacation Settings
GMAIL_UPDATE_VACATION_SETTINGSTool to update vacation responder settings for a Gmail user. Use when you need to configure out-of-office auto-replies.Input Parameters
Output
Triggers
Email Sent
Email Sent
GMAIL_EMAIL_SENT_TRIGGERType: pollTriggers when a Gmail message is sent by the authenticated user. It polls the ‘SENT’ label and emits metadata including sender, recipients, subject, timestamp, and thread ID.Configuration
polling_interval on the trigger instance instead. Minutes between checks for new events.Payload
New Gmail Message Received Trigger
New Gmail Message Received Trigger
GMAIL_NEW_GMAIL_MESSAGEType: pollTriggers when a new message is received in Gmail.Configuration
polling_interval on the trigger instance instead. Minutes between checks for new events.