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

# Setting Up SendGrid Integration

> Configure SendGrid as a Third-Party Sending Provider in SendPost with automatic webhook setup.

## Prerequisites

Before setting up the SendGrid integration, ensure you have:

### 1. SendGrid Account

* An active SendGrid account
* API key with **Mail Send** permissions

### 2. SendGrid API Key

To create an API key in SendGrid:

<Steps>
  <Step title="Log in to SendGrid">
    Log in to your [SendGrid Dashboard](https://app.sendgrid.com)
  </Step>

  <Step title="Navigate to API Keys">
    Go to **Settings** → **API Keys**
  </Step>

  <Step title="Create API Key">
    Click **Create API Key** and choose **Restricted Access**
  </Step>

  <Step title="Set Permissions">
    Enable the following permissions:

    * **Mail Send**: Full Access
    * **Event Webhook Settings**: Full Access (for automatic webhook setup)
  </Step>

  <Step title="Save Your Key">
    Click **Create & View** and **copy your API key** (you won't be able to see it again)
  </Step>
</Steps>

### 3. SendPost Account

* A SendPost account with admin access
* At least one sub-account created

***

## Setting Up SendGrid Integration

### Step 1: Navigate to Providers

1. Log in to your [SendPost Dashboard](https://app.sendpost.io)
2. Go to **Settings** → **Providers** (or navigate to the Providers page)
3. Click the **NEW** button

### Step 2: Configure SendGrid Provider

1. **Name**: Enter a descriptive name (e.g., "Production SendGrid", "Marketing SendGrid")
2. **Type**: Select **SendGrid** from the dropdown
3. **Key**: Paste your SendGrid API key
4. Click **Save**

### Step 3: Automatic Webhook Configuration

When you save the provider, SendPost automatically:

<Check>Registers a webhook with SendGrid</Check>
<Check>Configures the webhook to receive all supported events</Check>
<Check>Creates the necessary processing infrastructure</Check>

**Webhook URL Format**: `https://api.sendpost.io/tpsp/sendgrid/account/{your-account-id}`

**Events Configured**:

* Processed (sent)
* Delivered
* Bounced
* Dropped
* Opened
* Clicked
* Spam Reports
* Unsubscribes

### Step 4: Configure IP Pool for SendGrid Routing

Before sending emails via SendGrid, you need to configure an IP Pool in SendPost that routes traffic to your SendGrid provider.

#### Why IP Pools?

IP Pools in SendPost allow you to control how your email traffic is distributed between SendPost's native infrastructure and third-party providers like SendGrid. This enables:

* **Volume-based routing**: Split your email volume between SendGrid and SendPost infrastructure
* **Easy traffic management**: Adjust the percentage of emails sent via SendGrid vs SendPost at any time
* **Gradual migration**: Start with a small percentage on SendGrid and increase as needed
* **Failover capability**: Route traffic to SendGrid when SendPost IPs are warming up

#### Setting Up IP Pool for SendGrid

<Steps>
  <Step title="Create IP Pool">
    1. Go to **Settings** → **IP Pools** in your SendPost dashboard
    2. Click **Create New IP Pool**
    3. Enter a descriptive name (e.g., "sendgrid-pool" or "marketing-sendgrid")
  </Step>

  <Step title="Configure Routing">
    1. In the IP Pool settings, configure the routing to use your SendGrid provider
    2. Set the volume percentage you want to route through SendGrid
    3. You can easily adjust this percentage later to control traffic distribution
  </Step>

  <Step title="Save Configuration">
    Save your IP Pool configuration. The pool name will be used in your API calls.
  </Step>
</Steps>

#### Volume-Based Routing

You can configure what percentage of your email volume goes through SendGrid vs SendPost's native infrastructure:

| Configuration   | SendGrid                | SendPost Infrastructure |
| --------------- | ----------------------- | ----------------------- |
| 100% SendGrid   | All emails via SendGrid | None                    |
| 50/50 Split     | 50% of emails           | 50% of emails           |
| SendGrid Backup | 0% (failover only)      | 100% primary            |

<Info>
  You can change the volume distribution at any time through the SendPost UI without any code changes.
</Info>

### Step 5: Whitelist Your Sending Domain

You must whitelist the same sending domain in SendPost that you use in SendGrid.

<Warning>
  **Important**: The domain you use for sending emails (e.g., `yourdomain.com`) must be whitelisted in SendPost. This ensures proper email routing and deliverability.
</Warning>

1. Go to **Settings** → **Domains** in your SendPost dashboard
2. Click **Add Domain**
3. Enter the same domain you have configured in SendGrid (e.g., `yourdomain.com`)
4. Complete the domain verification process

<Note>
  If you're using multiple sending domains in SendGrid, you need to whitelist each domain in SendPost.
</Note>

***

## Next Steps

Once your SendGrid integration is set up, you can:

* [Send emails via SendGrid](/guides/sendgrid/sending-emails) using the SendPost API
* [Migrate from SendGrid](/guides/sendgrid/compatible-api) using the compatible API
* [View analytics](/guides/sendgrid/analytics) for your SendGrid emails
