> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://docs.mammoth.io/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# SendGrid connector

> Connect Mammoth to SendGrid with a restricted API key, query email delivery tables with SQL, and save the results as a dataset.

The SendGrid connector imports email delivery data from your SendGrid account into Mammoth as a dataset. Authentication uses a SendGrid API key—no OAuth flow required.

## Before you start

You need:

- A SendGrid account
- A SendGrid **API key** with read access to the data you want to import

### Create a SendGrid API key

1. In SendGrid, go to **Settings → API Keys**
2. Click **Create API Key**
3. Give it a name (e.g., `Mammoth Integration`)
4. Under **API Key Permissions**, select **Restricted Access**
5. Grant read access to the data you want to import
6. Click **Create & View** and copy the API key—it won't be shown again

## Step 1: Select the SendGrid connector

1. In Mammoth, go to **Data Library** and click **+ New Dataset**
2. Select **Connectors**
3. Search for **SendGrid** or find it in the **CRM & Marketing** category
4. Click the **SendGrid** tile

## Step 2: Create a connection

Click **New Connection** to open the credential form.

![SendGrid New Connection form with API Secret and Name fields and a notice to whitelist Mammoth's IP address](https://docs.mammoth.io/api/v1/images/20260826_114343_SendGrid_connection.png)

| Field | Description |
| --- | --- |
| **API Secret** | Your SendGrid restricted API key (the form labels this field "API Secret") |
| **Name** | A label for this connection (required) |

A callout below the fields shows Mammoth's IP address and reminds you to whitelist it if your SendGrid account restricts API access by IP—see [Network requirements](https://docs.mammoth.io/learn/connectors/network-requirements/).

Click **Connect**. Mammoth validates the API key and saves the connection; if validation fails, the error message appears at the bottom of the form.

![SendGrid Existing Connections list showing one saved connection and the New Connection button](https://docs.mammoth.io/api/v1/images/20260826_114450_sendgrid_identity_created.png)

## Step 3: Select SendGrid data and query

Select the connection under **Existing Connections** to open the query builder. The **List of tables** panel shows the tables this connector exposes. Click a table to load a `SELECT *` query for it and its preview.

### Write a custom SendGrid query

Edit the SQL in the **Enter SQL query** editor and click **Run**. Use the table and column names shown in the table list and the preview.

![SendGrid New Dataset dialog with the Alerts table selected, a SELECT query, data preview, and Save as dataset button](https://docs.mammoth.io/api/v1/images/20260826_114423_Sendgrid_table_selected.png)

See [Understanding data preview & query](https://docs.mammoth.io/learn/connectors/understanding-data-preview-query/) for a full guide.

## Step 4: Save the SendGrid dataset

1. Enter a **dataset name** in the **Save table as** field (e.g., *"SendGrid Email Stats"*)
2. Check the **Update Method** (the default is **Replace all data**). To change it, click the edit icon, pick an option, and click **Save changes**:
   - **Replace all data**—Replaces all existing data
   - **Add new data**—Adds new data based on a unique sequential column
   - **Replace with new data**—Replaces existing data with new data based on a unique sequential column
   For **Add new data** and **Replace with new data**, also choose a **Key column**—a numeric or date column with incrementing values, such as an ID or a date.
3. Click **Save as dataset**. When the dataset is saved, click **Done**

## Allow Mammoth's IP address in SendGrid

If your SendGrid account restricts API access by IP, add Mammoth's IP address, shown on the connection form, to the allowed list—see [Network requirements](https://docs.mammoth.io/learn/connectors/network-requirements/).

## Troubleshoot SendGrid connections

### Authentication fails

- Mammoth shows `Entered api key is not valid, Please enter the valid api key` when the key is rejected
- Confirm the API key is copied completely (they're long strings)
- Check the API key permissions include access to the data you're trying to query

---
Source: https://docs.mammoth.io/learn/connectors/sendgrid-connector.md · Updated: 2026-10-13