This connector is optimized for AI agents. For the data replication connector, see Gmail .
This is the full reference documentation for the Gmail agent connector.
Supported entities and actions
The Gmail connector supports the following entities and actions.
Entity Actions Profile Get Messages List , Get , Create , Update Labels List , Create , Get , Update , Delete Drafts List , Create , Get , Update , Delete Drafts Send Create Threads List , Get Messages Trash Create Messages Untrash Create
Profile
Profile Get
Gets the current user's Gmail profile including email address and mailbox statistics
Python SDK
await gmail . profile . get ( )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "profile", "action": "get" }'
Response Schema Records Field Name Type Description emailAddressstring | nullmessagesTotalinteger | nullthreadsTotalinteger | nullhistoryIdstring | null
Messages
Messages List
Lists the messages in the user's mailbox. Returns message IDs and thread IDs.
Python SDK
await gmail . messages . list ( )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "messages", "action": "list" }'
Parameters
Parameter Name Type Required Description maxResultsintegerNo Maximum number of messages to return (1-500) pageTokenstringNo Page token to retrieve a specific page of results qstringNo Gmail search query (same format as Gmail search box, e.g. "from:user@example.com", "is:unread", "subject:hello") labelIdsstringNo Only return messages with labels matching all of the specified label IDs (comma-separated) includeSpamTrashbooleanNo Include messages from SPAM and TRASH in the results
Response Schema Records Field Name Type Description idstringthreadIdstring | null
Field Name Type Description nextPageTokenstring | nullresultSizeEstimateinteger | null
Messages Get
Gets the full email message content including headers, body, and attachments metadata
Python SDK
await gmail . messages . get ( message_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "messages", "action": "get", "params": { "messageId": "<str>" } }'
Parameters
Parameter Name Type Required Description messageIdstringYes The ID of the message to retrieve format"full" | "metadata" | "minimal" | "raw"No The format to return the message in (full, metadata, minimal, raw) metadataHeadersstringNo When format is METADATA, only include headers specified (comma-separated)
Response Schema Records Field Name Type Description idstringthreadIdstring | nulllabelIdsarray | nullsnippetstring | nullhistoryIdstring | nullinternalDatestring | nullsizeEstimateinteger | nullrawstring | nullpayloadobject | any
Messages Create
Sends a new email message. The message should be provided as a base64url-encoded
RFC 2822 formatted string in the 'raw' field.
Python SDK
await gmail . messages . create ( raw = "<str>" , thread_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "messages", "action": "create", "params": { "raw": "<str>", "threadId": "<str>" } }'
Parameters
Parameter Name Type Required Description rawstringYes The entire email message in RFC 2822 format, base64url encoded threadIdstringNo The thread ID to reply to (for threading replies in a conversation)
Response Schema Records Field Name Type Description idstringthreadIdstring | nulllabelIdsarray | nullsnippetstring | nullhistoryIdstring | nullinternalDatestring | nullsizeEstimateinteger | nullrawstring | nullpayloadobject | any
Messages Update
Modifies the labels on a message. Use this to archive (remove INBOX label),
mark as read (remove UNREAD label), mark as unread (add UNREAD label),
star (add STARRED label), or apply custom labels.
Python SDK
await gmail . messages . update ( add_label_ids = [ ] , remove_label_ids = [ ] , message_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "messages", "action": "update", "params": { "addLabelIds": [], "removeLabelIds": [], "messageId": "<str>" } }'
Parameters
Parameter Name Type Required Description addLabelIdsarray<string>No A list of label IDs to add to the message (e.g. STARRED, UNREAD, or custom label IDs) removeLabelIdsarray<string>No A list of label IDs to remove from the message (e.g. INBOX to archive, UNREAD to mark as read) messageIdstringYes The ID of the message to modify
Response Schema Records Field Name Type Description idstringthreadIdstring | nulllabelIdsarray | nullsnippetstring | nullhistoryIdstring | nullinternalDatestring | nullsizeEstimateinteger | nullrawstring | nullpayloadobject | any
Labels
Labels List
Lists all labels in the user's mailbox including system and user-created labels
Python SDK
await gmail . labels . list ( )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "labels", "action": "list" }'
Response Schema Records Field Name Type Description idstringnamestring | nulltypestring | nullmessageListVisibilitystring | nulllabelListVisibilitystring | nullmessagesTotalinteger | nullmessagesUnreadinteger | nullthreadsTotalinteger | nullthreadsUnreadinteger | nullcolorobject | any
Labels Create
Creates a new label in the user's mailbox
Python SDK
await gmail . labels . create ( name = "<str>" , message_list_visibility = "<str>" , label_list_visibility = "<str>" , color = { } )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "labels", "action": "create", "params": { "name": "<str>", "messageListVisibility": "<str>", "labelListVisibility": "<str>", "color": {} } }'
Parameters
Parameter Name Type Required Description namestringYes The display name of the label messageListVisibility"show" | "hide"No The visibility of messages with this label in the message list (show or hide) labelListVisibility"labelShow" | "labelShowIfUnread" | "labelHide"No The visibility of the label in the label list colorobjectNo The color to assign to the label color.textColorstringNo The text color of the label as a hex string (#RRGGBB) color.backgroundColorstringNo The background color of the label as a hex string (#RRGGBB)
Response Schema Records Field Name Type Description idstringnamestring | nulltypestring | nullmessageListVisibilitystring | nulllabelListVisibilitystring | nullmessagesTotalinteger | nullmessagesUnreadinteger | nullthreadsTotalinteger | nullthreadsUnreadinteger | nullcolorobject | any
Labels Get
Gets a specific label by ID including message and thread counts
Python SDK
await gmail . labels . get ( label_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "labels", "action": "get", "params": { "labelId": "<str>" } }'
Parameters
Parameter Name Type Required Description labelIdstringYes The ID of the label to retrieve
Response Schema Records Field Name Type Description idstringnamestring | nulltypestring | nullmessageListVisibilitystring | nulllabelListVisibilitystring | nullmessagesTotalinteger | nullmessagesUnreadinteger | nullthreadsTotalinteger | nullthreadsUnreadinteger | nullcolorobject | any
Labels Update
Updates the specified label
Python SDK
await gmail . labels . update ( id = "<str>" , name = "<str>" , message_list_visibility = "<str>" , label_list_visibility = "<str>" , color = { } , label_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "labels", "action": "update", "params": { "id": "<str>", "name": "<str>", "messageListVisibility": "<str>", "labelListVisibility": "<str>", "color": {}, "labelId": "<str>" } }'
Parameters
Parameter Name Type Required Description idstringNo The ID of the label (must match the path parameter) namestringNo The new display name of the label messageListVisibility"show" | "hide"No The visibility of messages with this label in the message list labelListVisibility"labelShow" | "labelShowIfUnread" | "labelHide"No The visibility of the label in the label list colorobjectNo The color to assign to the label color.textColorstringNo The text color of the label as a hex string (#RRGGBB) color.backgroundColorstringNo The background color of the label as a hex string (#RRGGBB) labelIdstringYes The ID of the label to update
Response Schema Records Field Name Type Description idstringnamestring | nulltypestring | nullmessageListVisibilitystring | nulllabelListVisibilitystring | nullmessagesTotalinteger | nullmessagesUnreadinteger | nullthreadsTotalinteger | nullthreadsUnreadinteger | nullcolorobject | any
Labels Delete
Deletes the specified label and removes it from any messages and threads
Python SDK
await gmail . labels . delete ( label_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "labels", "action": "delete", "params": { "labelId": "<str>" } }'
Parameters
Parameter Name Type Required Description labelIdstringYes The ID of the label to delete
Drafts
Drafts List
Lists the drafts in the user's mailbox
Python SDK
await gmail . drafts . list ( )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "drafts", "action": "list" }'
Parameters
Parameter Name Type Required Description maxResultsintegerNo Maximum number of drafts to return (1-500) pageTokenstringNo Page token to retrieve a specific page of results qstringNo Gmail search query to filter drafts includeSpamTrashbooleanNo Include drafts from SPAM and TRASH in the results
Response Schema Records Field Name Type Description idstringmessageobject | any
Field Name Type Description nextPageTokenstring | nullresultSizeEstimateinteger | null
Drafts Create
Creates a new draft with the specified message content
Python SDK
await gmail . drafts . create ( message = { "raw" : "<str>" } )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "drafts", "action": "create", "params": { "message": { "raw": "<str>" } } }'
Parameters
Parameter Name Type Required Description messageobjectYes The draft message content message.rawstringYes The draft message in RFC 2822 format, base64url encoded message.threadIdstringNo The thread ID for the draft (for threading in a conversation)
Response Schema Records Field Name Type Description idstringmessageobject | any
Drafts Get
Gets the specified draft including its message content
Python SDK
await gmail . drafts . get ( draft_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "drafts", "action": "get", "params": { "draftId": "<str>" } }'
Parameters
Parameter Name Type Required Description draftIdstringYes The ID of the draft to retrieve format"full" | "metadata" | "minimal" | "raw"No The format to return the draft message in (full, metadata, minimal, raw)
Response Schema Records Field Name Type Description idstringmessageobject | any
Drafts Update
Replaces a draft's content with the specified message content
Python SDK
await gmail . drafts . update ( message = { "raw" : "<str>" } , draft_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "drafts", "action": "update", "params": { "message": { "raw": "<str>" }, "draftId": "<str>" } }'
Parameters
Parameter Name Type Required Description messageobjectYes The draft message content message.rawstringYes The draft message in RFC 2822 format, base64url encoded message.threadIdstringNo The thread ID for the draft (for threading in a conversation) draftIdstringYes The ID of the draft to update
Response Schema Records Field Name Type Description idstringmessageobject | any
Drafts Delete
Immediately and permanently deletes the specified draft (does not move to trash)
Python SDK
await gmail . drafts . delete ( draft_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "drafts", "action": "delete", "params": { "draftId": "<str>" } }'
Parameters
Parameter Name Type Required Description draftIdstringYes The ID of the draft to delete
Drafts Send
Drafts Send Create
Sends the specified existing draft to its recipients
Python SDK
await gmail . drafts_send . create ( id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "drafts_send", "action": "create", "params": { "id": "<str>" } }'
Parameters
Parameter Name Type Required Description idstringYes The ID of the draft to send
Response Schema Records Field Name Type Description idstringthreadIdstring | nulllabelIdsarray | nullsnippetstring | nullhistoryIdstring | nullinternalDatestring | nullsizeEstimateinteger | nullrawstring | nullpayloadobject | any
Threads
Threads List
Lists the threads in the user's mailbox
Python SDK
await gmail . threads . list ( )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "threads", "action": "list" }'
Parameters
Parameter Name Type Required Description maxResultsintegerNo Maximum number of threads to return (1-500) pageTokenstringNo Page token to retrieve a specific page of results qstringNo Gmail search query to filter threads labelIdsstringNo Only return threads with labels matching all of the specified label IDs (comma-separated) includeSpamTrashbooleanNo Include threads from SPAM and TRASH in the results
Response Schema Records Field Name Type Description idstringsnippetstring | nullhistoryIdstring | null
Field Name Type Description nextPageTokenstring | nullresultSizeEstimateinteger | null
Threads Get
Gets the specified thread including all messages in the conversation
Python SDK
await gmail . threads . get ( thread_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "threads", "action": "get", "params": { "threadId": "<str>" } }'
Parameters
Parameter Name Type Required Description threadIdstringYes The ID of the thread to retrieve format"full" | "metadata" | "minimal"No The format to return the messages in (full, metadata, minimal) metadataHeadersstringNo When format is METADATA, only include headers specified (comma-separated)
Response Schema Records Field Name Type Description idstringsnippetstring | nullhistoryIdstring | nullmessagesarray | nullmessages[].idstringmessages[].threadIdstring | nullmessages[].labelIdsarray | nullmessages[].snippetstring | nullmessages[].historyIdstring | nullmessages[].internalDatestring | nullmessages[].sizeEstimateinteger | nullmessages[].rawstring | nullmessages[].payloadobject | any
Messages Trash
Messages Trash Create
Moves the specified message to the trash
Python SDK
await gmail . messages_trash . create ( message_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "messages_trash", "action": "create", "params": { "messageId": "<str>" } }'
Parameters
Parameter Name Type Required Description messageIdstringYes The ID of the message to trash
Response Schema Records Field Name Type Description idstringthreadIdstring | nulllabelIdsarray | nullsnippetstring | nullhistoryIdstring | nullinternalDatestring | nullsizeEstimateinteger | nullrawstring | nullpayloadobject | any
Messages Untrash
Messages Untrash Create
Removes the specified message from the trash
Python SDK
await gmail . messages_untrash . create ( message_id = "<str>" )
API
curl --location 'https://api.airbyte.ai/api/v1/integrations/connectors/{your_connector_id}/execute' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {your_auth_token}' \ --data '{ "entity": "messages_untrash", "action": "create", "params": { "messageId": "<str>" } }'
Parameters
Parameter Name Type Required Description messageIdstringYes The ID of the message to untrash
Response Schema Records Field Name Type Description idstringthreadIdstring | nulllabelIdsarray | nullsnippetstring | nullhistoryIdstring | nullinternalDatestring | nullsizeEstimateinteger | nullrawstring | nullpayloadobject | any