> For the complete documentation index, see [llms.txt](https://docs.middle.app/middle-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.middle.app/middle-docs/guides/app-reference/gmail.md).

# Gmail

Creating a Gmail OAuth App in Your Google Organization

Please follow these instructions to set up your Gmail app and credentials:

{% hint style="warning" %}
This Gmail integration is only configured for Internal emails. If you have an existing project with an OAuth consent configured to external, please consider creating a new Google Project to connect this email to.
{% endhint %}

1. [Create a Google Cloud Project](https://developers.google.com/workspace/guides/create-project). It’s recommended that you create a unique Google Cloud project for this integration.
2. Navigate to the home screen (you can get here by clicking Google Cloud at the top)

<figure><img src="https://lh5.googleusercontent.com/uCWtXLzkyOFLPk2xvPrzTKS4hDNZz-unn0rjguGWN79hElZUI_steNvJxEYPLLo0VIvAGXH8UtqbMl0uAD9sRqtGgO5SVfA3NXWXdwvyktABYaYwtt8qQu3xLTBckhWeRM_N3dWZImEYMhtN-2Xhpt8" alt=""><figcaption><p>A new Google Cloud project</p></figcaption></figure>

3. Click **APIs & Services**
4. Ensure Gmail API is in the list
5. If not, add it using [+ Enable API & Services](https://developers.google.com/workspace/guides/enable-apis) and search for Gmail API.
6. Complete the app registration form (app name, app contact)
7. Add an authorized domain: [middle.app](https://active.middle.app)
8. Click **Save and Continue**

## Connecting an Email to a Middle Account

Once a Middle developer finishes setting up your credentials, you will be able to connect an email address to your Gmail integration.

It is recommended that you [create a Google user/email account within your Google Organization](https://support.google.com/a/answer/33310?hl=en\&ref_topic=14586\&sjid=5487452285989823657-NA) that can be used for this use case. The Gmail address that connects to your Middle account connection will be the one that is used to send emails. If you opted to sync emails as well, this would be the same email address.

Once that account is created, you can set up the connection through Middle.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.middle.app/middle-docs/guides/app-reference/gmail.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
