> ## Documentation Index
> Fetch the complete documentation index at: https://nango.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Gmail

> Integrate your application with the Gmail API

## 🚀 Quickstart

Connect to Gmail with Nango and see data flow in 2 minutes.

**1. Create the integration**

In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> *Configure New Integration* -> *Gmail*.

> [!NOTE]
>
> Nango has a [Nango-managed OAuth app](https://nango.dev/docs/guides/auth/auth-guide.md#nango-managed-oauth-apps) you can use in development and production. Select it when you create the integration.

**2. Authorize Gmail**

Go to [Connections](https://app.nango.dev/dev/connections) -> *Add Test Connection* -> *Authorize*, then log in to Gmail. Later, you'll let your users do the same directly from your app.

**3. Call the Gmail API**

Let's make your first request to the Gmail API (fetch the profile of the currently signed-in user). This request will return basic details about the authenticated user, such as their email address and message/thread counts. Replace the placeholders below with your [Environment API key](https://nango.dev/docs/reference/backend/http-api/api-keys.md), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):

> [tab] cURL
>
> ```bash theme={null}
> curl "https://api.nango.dev/proxy/gmail/v1/users/me/profile" \
>   -H "Authorization: Bearer <NANGO-API-KEY>" \
>   -H "Provider-Config-Key: <INTEGRATION-ID>" \
>   -H "Connection-Id: <CONNECTION-ID>"
> ```

> [tab] Node
>
> Install Nango's backend SDK with `npm i @nangohq/node`. Then run:
>
> ```typescript theme={null}
> import { Nango } from '@nangohq/node';
>
> const nango = new Nango({ apiKey: '<NANGO-API-KEY>' });
>
> const res = await nango.get({
>     endpoint: '/gmail/v1/users/me/profile',
>     providerConfigKey: '<INTEGRATION-ID>',
>     connectionId: '<CONNECTION-ID>'
> });
>
> console.log(res.data);
> ```

Or fetch credentials dynamically via the [Node SDK](https://nango.dev/docs/reference/backend/backend-sdk/node.md#get-a-connection-with-credentials) or [API](https://nango.dev/docs/reference/backend/http-api/connections/get.md).

✅ You're connected! Check the [Logs](https://app.nango.dev/dev/logs) tab in Nango to inspect requests.

**4. Implement Nango in your app**

Follow our [Auth implementation guide](https://nango.dev/docs/guides/primitives/auth.md) to integrate Nango in your app.

To use your own OAuth app instead of the Nango-managed one, follow the setup guide linked below.

## 📚 Gmail Integration Guides

Nango maintained guides for common use cases.

* [How to register your own Gmail OAuth app](https://nango.dev/docs/api-integrations/google-mail/how-to-register-your-own-gmail-api-oauth-app)\
  Register an OAuth app with Gmail and obtain credentials to connect it to Nango

* [How to setup webhooks with Gmail on Nango](https://nango.dev/docs/api-integrations/google-mail/webhooks)
  Set up Gmail push notifications using Google Pub/Sub to receive real-time inbox updates

* [Google App & Security Review](https://nango.dev/docs/api-integrations/google-shared/google-security-review)
  Pass Google's OAuth app verification and CASA security assessment to go to production with your own OAuth app (not needed with the Nango-managed app)

Official docs: [Gmail API docs](https://developers.google.com/gmail/api/reference/rest)

## 🧩 Pre-built syncs & tools for Gmail

Explore Nango-provided tools in your dashboard. Extend and customize them to fit your needs.

### Others

| Function name | Description | Type |
| - | - | - |
| `batch-delete-messages` | Permanently delete multiple Gmail messages by ID | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `batch-modify-messages` | Add and remove labels on multiple Gmail messages at once. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `create-draft` | Create a Gmail draft message from RFC 2822 MIME content. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `create-filter` | Create a mailbox filter with match criteria and label actions. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `create-label` | Create a new user label with visibility settings. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `create-send-as-alias` | Create a custom send-as alias for the mailbox | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `delete-draft` | Delete an existing draft by draft ID | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `delete-filter` | Delete a mailbox filter by filter ID | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `delete-forwarding-address` | Delete a forwarding address from Gmail settings. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `delete-label` | Delete a user-created label | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `delete-message` | Permanently delete a Gmail message by ID. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `delete-send-as-alias` | Delete a custom send-as alias from the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `delete-thread` | Permanently delete a Gmail thread and its messages. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-attachment` | Retrieve a specific message attachment payload by attachment ID. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-auto-forwarding-settings` | Retrieve the mailbox auto-forwarding configuration. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-draft` | Retrieve a draft and its embedded message payload. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-filter` | Retrieve a mailbox filter by filter ID. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-forwarding-address` | Retrieve a forwarding address configured for the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-imap-settings` | Retrieve IMAP settings for the mailbox | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-label` | Retrieve a single Gmail label by label ID. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-language-settings` | Retrieve Gmail language settings for the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-message` | Retrieve a specific Gmail message with optional format selection. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-pop-settings` | Retrieve POP settings for the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-send-as-alias` | Retrieve a configured send-as alias | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-thread` | Retrieve a Gmail thread and its messages. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `get-vacation-settings` | Retrieve the mailbox vacation responder settings. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-drafts` | List drafts in the mailbox with pagination support. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-filters` | List mailbox filters configured for the authenticated user | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-forwarding-addresses` | List forwarding addresses configured for the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-labels` | List built-in and user-created mailbox labels. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-messages` | List messages matching Gmail query and label filters. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-send-as-aliases` | List send-as aliases available for the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-threads` | List conversation threads matching Gmail query and label filters. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `list-watch-history` | List mailbox history records after a given history ID | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `modify-message` | Add and remove labels on a Gmail message | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `modify-thread` | Add and remove labels across a Gmail thread. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `send-draft` | Send an existing draft message | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `send-message` | Send an email message through Gmail using raw MIME content. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `stop-watch` | Stop Gmail push notification watch state for the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `trash-message` | Move a Gmail message to trash | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `trash-thread` | Move a Gmail thread to trash. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `untrash-message` | Restore a trashed Gmail message to the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `untrash-thread` | Restore a trashed Gmail thread to the mailbox. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-auto-forwarding-settings` | Update Gmail auto-forwarding behavior and disposition | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-draft` | Replace an existing draft with new MIME content. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-imap-settings` | Update IMAP enablement and visibility settings. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-label` | Update a user-created label's name or visibility settings. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-language-settings` | Update the mailbox display language | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-pop-settings` | Update POP access settings for the mailbox | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-send-as-alias` | Update send-as alias settings such as display name or reply-to. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-send-as-smtp-msa` | Update the SMTP MSA settings for a send-as alias. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `update-vacation-settings` | Update the mailbox vacation responder configuration. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `verify-send-as-alias` | Trigger verification for a custom send-as alias | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `watch-mailbox` | Start Gmail push notifications for mailbox changes. | [Tool](https://nango.dev/docs/guides/functions/tools.md) |
| `filters` | Sync Gmail mailbox filters and their criteria or actions. | [Sync](https://nango.dev/docs/guides/functions/syncs/sync-functions.md) |
| `labels` | Sync built-in and user-created Gmail labels. | [Sync](https://nango.dev/docs/guides/functions/syncs/sync-functions.md) |
| `messages` | Sync Gmail messages with an initial backfill followed by history-based incremental updates. | [Sync](https://nango.dev/docs/guides/functions/syncs/sync-functions.md) |
| `send-as-aliases` | Sync configured Gmail send-as aliases and alias settings | [Sync](https://nango.dev/docs/guides/functions/syncs/sync-functions.md) |
| `threads` | Sync Gmail conversation threads with full message hydration | [Sync](https://nango.dev/docs/guides/functions/syncs/sync-functions.md) |

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.