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

# SendGrid

> Send transactional email and manage marketing contacts with Twilio SendGrid

## At a glance

* **Availability**: Experimental ([how to enable](/cloud/integrations)).
* **Auth**: API key.
* **Connection**: The key comes from `SENDGRID_API_KEY`.
* **Docs**: [https://www.twilio.com/docs/sendgrid/api-reference/how-to-use-the-sendgrid-v3-api/authentication](https://www.twilio.com/docs/sendgrid/api-reference/how-to-use-the-sendgrid-v3-api/authentication)

## Credentials

Set these per environment. See [Connect an integration](/cloud/integrations).

| Variable           | Required | Description                                                                                                       |
| ------------------ | -------- | ----------------------------------------------------------------------------------------------------------------- |
| `SENDGRID_API_KEY` | Yes      | SendGrid API key (starts with SG.) [Docs](https://www.twilio.com/docs/sendgrid/ui/account-and-settings/api-keys). |

## Setup

1. **Sign in to SendGrid**: Go to [https://app.sendgrid.com](https://app.sendgrid.com) and sign in. A free tier account is sufficient for testing.
2. **Verify a sender**: Under Settings → Sender Authentication, verify a single sender address or authenticate your domain. Mail Send rejects unverified 'from' addresses.
3. **Create an API key**: Open Settings → API Keys ([https://app.sendgrid.com/settings/api\_keys](https://app.sendgrid.com/settings/api_keys)) and create a key with Full Access, or Restricted Access including Mail Send, Marketing, Template Engine, and Stats.
4. **Set the environment variable**: Add the key to your .env as SENDGRID\_API\_KEY=SG....
5. **Verify access**: Run List Templates to confirm the key works, then send a test email to yourself.

* SendGrid authenticates with 'Authorization: Bearer SG.xxx'
* Mail Send returns HTTP 202 with an empty body on success
* Upsert Contacts is asynchronous - changes can take a few minutes to appear in List Contacts

Provider API reference: [https://www.twilio.com/docs/sendgrid/api-reference](https://www.twilio.com/docs/sendgrid/api-reference)

## Tools

| Tool            | Access | Description                                                                      |
| --------------- | ------ | -------------------------------------------------------------------------------- |
| Send Email      | Write  | Send an email via the SendGrid v3 Mail Send API                                  |
| List Contacts   | Read   | List marketing contacts in the account                                           |
| Search Contacts | Read   | Search marketing contacts with an SGQL query (read-only search via POST)         |
| Upsert Contacts | Write  | Add or update marketing contacts (asynchronous; returns a job\_id)               |
| List Templates  | Read   | List transactional email templates                                               |
| Get Email Stats | Read   | Get global email statistics (delivered, opens, clicks, bounces) for a date range |

## Example prompts

* Send an email via SendGrid with a subject, recipient, and HTML body.
* Show my SendGrid email stats for the last 30 days and summarize delivery, open, and bounce rates.
