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

# SendGrid

> Integrate Mavera with SendGrid — device/geography persona refinement, A/B focus group extension, and bulk contact-to-persona pipelines

## Overview

Pull data from **SendGrid** (Single Send Stats, A/B Tests, Marketing Contacts) → analyze with **Mavera** (Custom Personas, Focus Groups, Mave Agent) → refine personas by real engagement behavior, extend A/B tests with synthetic feedback, and create personas at scale from your contact database.

<Info>
  **SendGrid API** — Base URL: `https://api.sendgrid.com/v3/`. Auth: API Key as `Authorization: Bearer SG.xxxxx`. Rate limits: **600 req/min** (10/sec sustained). Marketing endpoints share the same pool.
</Info>

***

## Prerequisites

<Steps>
  <Step title="SendGrid API key">Create an API key at [Settings → API Keys](https://app.sendgrid.com/settings/api_keys) with scopes: `marketing.read`, `stats.read`, `marketing.contacts.read`.</Step>
  <Step title="Mavera API key">Get your key from [Mavera dashboard](https://app.mavera.io/settings/api-keys).</Step>

  <Step title="Environment variables">
    ```bash theme={"dark"}
    export SENDGRID_API_KEY="SG.xxxxx"
    export MAVERA_API_KEY="mvra_live_xxxxx"
    ```
  </Step>
</Steps>

***

## Jobs

| # | Job                                                                         | SendGrid Data                     | Mavera Surface           | Output                      |
| - | --------------------------------------------------------------------------- | --------------------------------- | ------------------------ | --------------------------- |
| 1 | [Email Stats by Device/Geography → Persona Refinement](device-geo-personas) | Single send stats with breakdowns | Custom Personas (update) | Device/geo-refined personas |
| 2 | [Single Send A/B → Focus Group Extension](ab-focus-group-extension)         | A/B test results                  | Focus Groups             | Qualitative A/B feedback    |
| 3 | [Contact Export → Bulk Persona Creation](bulk-persona-creation)             | Marketing contacts export         | Custom Personas          | Segment personas at scale   |

***

***

## Rate Limits & Production Notes

| Endpoint               | Limit                | Strategy                                    |
| ---------------------- | -------------------- | ------------------------------------------- |
| All endpoints (shared) | 600 req/min          | 100ms delay between calls                   |
| Contact exports        | 1 concurrent         | Wait for completion before starting another |
| Single send stats      | 600 req/min (shared) | Batch with delays                           |
| Marketing contacts     | 600 req/min (shared) | Use exports for bulk reads                  |

<Warning>
  All SendGrid endpoints share the **600 req/min** pool. A bulk stats pull plus persona creation can burn through this quickly. Space requests at 100ms+ and monitor `X-RateLimit-Remaining` headers.
</Warning>

**Production checklist:**

* Store `SENDGRID_API_KEY` and `MAVERA_API_KEY` in a secrets manager.
* Use segment-specific exports rather than full contact list exports to reduce data volume and processing time.
* For A/B extension jobs, create your personas once and reuse IDs across multiple test analyses via `PERSONA_IDS` env var.
* Contact exports generate temporary download URLs that expire. Download immediately after the export completes.
* Monitor Mavera credits at [Dashboard](https://app.mavera.io/settings/usage).

***

<CardGroup cols={3}>
  <Card title="All Integrations" icon="plug" href="/integrations" />

  <Card title="SendGrid API" icon="paper-plane" href="https://docs.sendgrid.com/api-reference" />

  <Card title="Personas" icon="user" href="/features/personas" />

  <Card title="Focus Groups" icon="users" href="/features/focus-groups" />

  <Card title="Mave Agent" icon="brain" href="/features/mave-agent" />

  <Card title="Generate" icon="wand-magic-sparkles" href="/features/generate" />
</CardGroup>
