---
title: "SendGrid Connector"
description: "Complete SendGrid integration guide for syncing contacts, transactional emails, marketing campaigns, and engagement events with Brevo via Tajo."
url: https://tajo.io/docs/connectors/marketing/sendgrid/
markdown: https://tajo.io/docs/connectors/marketing/sendgrid.md
lang: en-US
robots: noindex
---

# SendGrid Connector

Connector status: In progress Being built. Not verified yet.

| Source field | Destination field | Sample value |
| --- | --- | --- |
| `record.id` | `source_id` | `record_1042` |
| `record.updated_at` | `updated_at` | `2026-10-18T08:00:00Z` |
| `record.value` | `value` | `sample_value` |

Connect your SendGrid account to Brevo via Tajo for email infrastructure migration, contact synchronization, campaign data transfer, and unified engagement analytics across both platforms.

## Overview

| Property | Value |
| --- | --- |
| **Platform** | SendGrid (Twilio) |
| **Category** | Marketing |
| **Setup Complexity** | Easy |
| **Official Integration** | No |
| **Data Synced** | Contacts, Campaigns, Transactional Email, Events |
| **API Base URL** | `https://api.sendgrid.com/v3` |

## Features

- **Contact migration** - Migrate SendGrid Marketing contacts to Brevo with custom fields
- **Transactional email sync** - Track transactional email events for unified reporting
- **Campaign data** - Sync Single Send and Automation campaign performance data
- **Event webhooks** - Forward email events (delivered, opened, clicked, bounced) to Brevo
- **Suppression sync** - Migrate bounce, block, and unsubscribe lists for compliance
- **Template migration** - Export Dynamic Transactional Templates for Brevo use
- **Sender verification** - Sync verified sender identities and domain authentication
- **Statistics sync** - Import historical engagement statistics to Brevo attributes

## Prerequisites

Before you begin, ensure you have:

1. A SendGrid account (Free, Essentials, Pro, or Premier)
2. A SendGrid API key with required permissions
3. A Brevo account with API access
4. A Tajo account

## Authentication

### API Key Authentication

SendGrid uses bearer token authentication.

```bash
curl https://api.sendgrid.com/v3/marketing/contacts \
  -H "Authorization: Bearer SG.YOUR_API_KEY" \
  -H "Content-Type: application/json"
```

Create API keys in SendGrid Settings > API Keys with specific permission levels:

- **Full Access** - Complete API access
- **Restricted Access** - Granular permission control
- **Billing Access** - Billing-only operations

#### Required Permissions

```
Marketing: Full Access
  - Contacts (read)
  - Single Sends (read)
  - Automations (read)
Mail Send: Full Access
  - Mail Send (read)
Stats: Read Access
Suppressions: Read Access
Tracking: Read Access
```

API Key Security

SendGrid API keys are shown only once at creation. Store them securely. If lost, you must create a new key.

## Configuration

### Basic Setup

```yaml
connectors:
  sendgrid:
    enabled: true
    api_key: "${SENDGRID_API_KEY}"

    # Data sync options
    sync:
      contacts: true
      campaigns: true
      transactional: true
      suppressions: true
      statistics: true

    # List mapping to Brevo
    list_mapping:
      "All Contacts": 60
      "Newsletter": 61
      "Transactional": 62
```

### Field Mapping

Map SendGrid contact fields to Brevo contact attributes:

#### Default Mappings

| Parameter | Type | Description |
| --- | --- | --- |
| `email` required | string | Contact email address (unique identifier) |
| `first_name` optional | string | Maps to FIRSTNAME attribute |
| `last_name` optional | string | Maps to LASTNAME attribute |
| `phone_number` optional | string | Maps to SMS attribute |
| `city` optional | string | Contact city |
| `country` optional | string | Contact country |
| `custom_fields` optional | object | Custom field key-value pairs |
| `list_ids` optional | array | SendGrid list memberships |

#### Custom Field Mapping

```yaml
field_mapping:
  # Standard fields
  email: email
  first_name: FIRSTNAME
  last_name: LASTNAME
  phone_number: SMS

  # Location fields
  city: CITY
  state_province_region: STATE
  country: COUNTRY
  postal_code: POSTAL_CODE

  # Engagement metrics
  avg_open_rate: AVG_OPEN_RATE
  avg_click_rate: AVG_CLICK_RATE

  # Custom fields
  custom_fields.company: COMPANY_NAME
  custom_fields.plan: PLAN_TYPE
```

## API Endpoints

### Marketing Contacts

| Method | Endpoint | Description |
| --- | --- | --- |
| `PUT` | `/v3/marketing/contacts` | Add or update contacts |
| `POST` | `/v3/marketing/contacts/search` | Search contacts |
| `GET` | `/v3/marketing/contacts/count` | Get contact count |
| `POST` | `/v3/marketing/contacts/exports` | Export contacts |
| `DELETE` | `/v3/marketing/contacts` | Delete contacts |
| `GET` | `/v3/marketing/lists` | List all contact lists |

### Transactional Email (Mail Send)

| Method | Endpoint | Description |
| --- | --- | --- |
| `POST` | `/v3/mail/send` | Send an email |
| `GET` | `/v3/templates` | List Dynamic Templates |
| `GET` | `/v3/templates/{id}` | Get template details |

### Campaigns (Single Sends)

| Method | Endpoint | Description |
| --- | --- | --- |
| `GET` | `/v3/marketing/singlesends` | List Single Sends |
| `GET` | `/v3/marketing/singlesends/{id}` | Get Single Send details |
| `GET` | `/v3/marketing/automations` | List Automations |

### Statistics

| Method | Endpoint | Description |
| --- | --- | --- |
| `GET` | `/v3/stats` | Get global email statistics |
| `GET` | `/v3/categories/stats` | Get category statistics |
| `GET` | `/v3/marketing/stats/singlesends` | Get Single Send stats |

### Suppressions

| Method | Endpoint | Description |
| --- | --- | --- |
| `GET` | `/v3/suppression/bounces` | List bounced emails |
| `GET` | `/v3/suppression/blocks` | List blocked emails |
| `GET` | `/v3/suppression/spam_reports` | List spam reports |
| `GET` | `/v3/suppression/unsubscribes` | List global unsubscribes |

## Events

### Email Events (via Event Webhook)

| Event | Trigger | Use Case |
| --- | --- | --- |
| `processed` | Email accepted by SendGrid | Send confirmation |
| `delivered` | Email delivered to recipient | Delivery tracking |
| `open` | Email opened | Engagement scoring |
| `click` | Link clicked | Interest tracking |
| `bounce` | Email bounced | List hygiene |
| `dropped` | Email suppressed | Compliance review |
| `deferred` | Delivery deferred | Retry monitoring |
| `spam_report` | Marked as spam | Reputation management |
| `unsubscribe` | Unsubscribed via link | Preference sync |

## Code Examples

### Initialize Connector

```javascript
import { TajoClient } from '@tajo/sdk';

const tajo = new TajoClient({
  apiKey: process.env.TAJO_API_KEY,
  brevoApiKey: process.env.BREVO_API_KEY
});

// Connect SendGrid
await tajo.connectors.connect('sendgrid', {
  apiKey: process.env.SENDGRID_API_KEY
});
```

### Migrate Contacts to Brevo

```javascript
// Full contact migration from SendGrid to Brevo
await tajo.connectors.sync('sendgrid', {
  type: 'full',
  resources: ['contacts', 'suppressions'],
  options: {
    includeCustomFields: true,
    migrateListMemberships: true,
    migrateSuppressions: true
  }
});

// Check migration status
const status = await tajo.connectors.status('sendgrid');
console.log(status);
// {
//   connected: true,
//   lastSync: '2024-01-15T10:30:00Z',
//   contactsMigrated: 45000,
//   suppressionsSynced: 3200,
//   listsMapped: 8
// }
```

### Forward Email Events

```javascript
// Handle SendGrid Event Webhook
app.post('/webhooks/sendgrid', async (req, res) => {
  const signature = req.get('X-Twilio-Email-Event-Webhook-Signature');

  // Verify webhook signature (ECDSA)
  if (!verifySendGridSignature(req.body, signature)) {
    return res.status(401).send('Unauthorized');
  }

  // Process batch of events
  for (const event of req.body) {
    await tajo.connectors.handleWebhook('sendgrid', {
      type: event.event,
      email: event.email,
      timestamp: event.timestamp,
      payload: event
    });
  }

  res.status(200).send('OK');
});
```

## Rate Limits

SendGrid API rate limits:

| Endpoint | Limit | Details |
| --- | --- | --- |
| Mail Send (`/v3/mail/send`) | Plan-dependent | Free: 100/day, Essentials: based on plan |
| Marketing Contacts PUT | 3 requests/second | Batch up to 30,000 contacts |
| Marketing Contacts Search | 50 requests/second | Per API key |
| General API | 1,000 requests/second | Per API key |
| Event Webhook | Batch delivery | Up to 1,000 events per POST |

Mail Send Limits

Mail Send limits depend on your SendGrid plan. Free accounts are limited to 100 emails/day. Check your plan details for exact sending limits.

## Troubleshooting

### Common Issues

| Issue | Cause | Solution |
| --- | --- | --- |
| 401 Unauthorized | Invalid API key | Verify API key in SendGrid Settings |
| 403 Forbidden | Insufficient API key permissions | Create new key with required scopes |
| Contact export pending | Large dataset processing | Poll export status endpoint until complete |
| Suppression sync incomplete | Pagination required | Implement pagination with offset parameter |
| Event webhook not received | URL not verified | Complete webhook URL verification in SendGrid |

### Debug Mode

Enable verbose logging:

```yaml
connectors:
  sendgrid:
    debug: true
    log_level: verbose
    log_webhooks: true
```

### Test Connection

```bash
tajo connectors test sendgrid
# ✓ API connection successful
# ✓ Contacts readable
# ✓ Lists accessible
# ✓ Statistics readable
# ✓ Suppressions accessible
```

## Best Practices

1. **Migrate suppressions first** - Ensure bounces, blocks, and unsubscribes are in Brevo before sending
2. **Use batch contact uploads** - PUT up to 30,000 contacts per request for efficiency
3. **Verify Event Webhook** - Enable signed webhooks with ECDSA verification
4. **Map custom fields** - Create corresponding Brevo attributes before contact migration
5. **Sync engagement data** - Import historical stats for segmentation in Brevo
6. **Handle async exports** - Contact exports are asynchronous; poll for completion

## Security

- **API Key Authentication** - Bearer token with granular permission levels
- **Event Webhook signing** - ECDSA signature verification for webhook payloads
- **TLS encryption** - All API communication encrypted via HTTPS
- **IP Access Management** - Restrict Dashboard and API access by IP
- **Two-factor authentication** - 2FA available for account access

## Related Resources

- [SendGrid API Documentation](https://docs.sendgrid.com/api-reference)
- [SendGrid Event Webhook Guide](https://docs.sendgrid.com/for-developers/tracking-events/event)
- [Brevo Connector](https://tajo.io/docs/connectors/marketing/brevo)
- [Mailchimp Connector](https://tajo.io/docs/connectors/marketing/mailchimp)
- [Customer Sync Skill](https://tajo.io/docs/skills/data-sync/customer-sync)

## Open-Source Implementation Map

This section is derived from official or public repository material discovered for the SendGrid connector. Use it as the engineering companion to the setup guide above: it shows where the API surface lives, what implementation assets exist, and how Tajo should translate them into reliable Brevo sync behavior.

### Repository Snapshot

| Repository | Commit | Languages / formats | Files |
| --- | --- | --- | --- |
| [twilio/sendgrid-oai](https://github.com/twilio/sendgrid-oai) | fb95a93 | JSON (47), YAML (47), Markdown (5), YAML (1), gitignore (1), license (1) | 103 |

### Integration Shape

```mermaid
graph LR
  Source["SendGrid API / repository"] --> Auth["Auth and scopes"]
  Source --> Objects["Objects, events, and schemas"]
  Auth --> Tajo["Tajo connector runtime"]
  Objects --> Tajo
  Tajo --> Brevo["Brevo contacts, attributes, lists, campaigns"]
  Tajo --> Ops["Backfill, cursor, retries, logs"]
```

### What To Reuse

- Sendgrid’s OpenAPI Specification
- This repository contains OpenAPI documents
- The SendGrid OAI specifications are automatically generated from the SendGrid OAS specifications using the ‘sendgrid-oas-transpiler’.
- The ‘sendgrid-oai’ is utilized to auto-generate SendGrid helper libraries through the ‘sendgrid-oai-generator’.
- Currently, only the ‘sendgrid-java’ helper library is available for auto-generation.

### Tajo Revamp Checklist

- Keep authentication setup aligned with the vendor docs and the public repository’s current API shape.
- Map primary resources into explicit Tajo sync objects with stable external IDs.
- Prefer cursor-based or updated-at incremental sync where the API exposes it; otherwise document the fallback.
- Treat webhook handlers as idempotent and replay-safe, especially for order, contact, ticket, and campaign events.
- Capture pagination, rate limits, retry headers, and partial-failure behavior in connector smoke tests.
- Keep examples small and runnable against sandbox or test-mode accounts.

### Sources

- [twilio/sendgrid-oai](https://github.com/twilio/sendgrid-oai)
- [Vendor documentation](https://www.twilio.com/docs/sendgrid/api-reference)
