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

# Gmail

> Connect Gmail to read, search, and send emails.

## Connect

1. In [Google Cloud Console](https://console.cloud.google.com), enable the
   **Gmail API**, configure the OAuth consent screen, and create OAuth
   credentials for a **Desktop app**.
2. Import the downloaded JSON with the setup assistant in **Settings →
   Integrations**. Arden stores it as `~/.arden/gmail_credentials.json`.
3. Open the **Gmail** card and click **Connect**. Arden opens a local browser
   consent flow and saves an account-specific token under `~/.arden/`.

Use **Add account** to connect another Google account.

## Manual setup

If you do not use the desktop assistant, place your Google OAuth Desktop app credentials at:

```bash theme={null}
~/.arden/gmail_credentials.json
```

With the server running, connect and enable Gmail:

```bash theme={null}
curl -X POST http://localhost:6877/google/gmail/connect \
  -H "Authorization: Bearer $ARDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

curl -X PATCH http://localhost:6877/config \
  -H "Authorization: Bearer $ARDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"integrations":{"gmail":true}}'
```

## Google verification note

Arden currently uses **bring-your-own Google OAuth credentials**. Gmail scopes
such as read and send are restricted Google scopes. Your credentials keep setup
local and avoid routing Gmail access through a third-party auth broker.

## Configuration

| Variable           | Default | Description                    |
| ------------------ | ------- | ------------------------------ |
| `ARDEN_GMAIL_DAYS` | `30`    | Days of email history to index |

## Available tools

| Tool          | Description                                     |
| ------------- | ----------------------------------------------- |
| `emails`      | Search and list emails by date or query         |
| `read_email`  | Get full email content by ID                    |
| `send_email`  | Send an email (requires approval)               |
| `reply_email` | Reply in an existing thread (requires approval) |

## Troubleshooting

* **Missing credentials** – import a Google OAuth Desktop app JSON; Web application credentials are rejected.
* **Access denied / test user** – if your OAuth app is still in Testing mode, add your Google account as a test user.
* **API not enabled / 403** – enable the Gmail API in the same Google Cloud project.
* **Missing scope** – disconnect and reconnect Gmail.

## Multiple accounts

Add more accounts from the Gmail card. Tokens are stored per account and
service under `~/.arden/`.
