---
title: "Migrate from SendGrid to Nextmail"
description: "Move from SendGrid to Nextmail: every field mapped, a code converter for Node.js, Python, Ruby, PHP and cURL, and the webhook events side by side."
url: "https://nextmail.sh/migrate/sendgrid"
---

[All migrations](https://nextmail.sh/migrate.md)

Migrate from SendGrid

# Move from SendGrid to Nextmail.

Point the SendGrid SDK at Nextmail and keep your code, or convert it to the Nextmail SDK. Personalizations, categories and the event webhook are mapped field by field.

[Convert your code](https://nextmail.sh/migrate/sendgrid#convert) [Open mail](https://nextmail.sh/mail/inbox) [Get Started](https://nextmail.sh/signup.md)

## The same email, written both ways.

One message with a reply-to address and a tag, sent through SendGrid and then through Nextmail.

```
1import sgMail from '@sendgrid/mail'2 3sgMail.setApiKey(process.env.SENDGRID_API_KEY)4 5try {6  const [response] = await sgMail.send({7    from: { email: 'billing@acme.com', name: 'Acme' },8    to: 'ada@example.com',9    replyTo: 'support@acme.com',10    subject: 'Your invoice is ready',11    html: '<p>Thanks for your order.</p>',12    categories: ['invoice'],13  })14  console.log(response.statusCode)15} catch (error) {16  console.error(error.response?.body ?? error)17}
```

```
1import { init, nextmail } from '@nextmail/sdk'2 3init({ apiKey: process.env.NEXTMAIL_API_KEY })4 5try {6  const email = await nextmail.emails.send({7    from: { email: 'billing@acme.com', name: 'Acme' },8    to: 'ada@example.com',9    replyTo: 'support@acme.com',10    subject: 'Your invoice is ready',11    html: '<p>Thanks for your order.</p>',12    tags: { category: 'invoice' },13  })14  console.log(email.status)15} catch (error) {16  console.error(error.message)17}
```

## Field by field, what goes where.

Each option SendGrid takes, and its place in Nextmail.

| SendGrid | Nextmail | Notes |
| --- | --- | --- |
| `personalizations[].to` | `to` | One message per personalization. |
| `reply_to` | `replyTo` | One address per message. |
| `content[]` | `html, text` | One field per content type. |
| `template_id, dynamic_template_data` | `template: { id, props }` | Recreate the template in Nextmail first. |
| `categories, custom_args` | `tags` | Up to 10 key and value pairs. |
| `send_at` | `scheduledAt` | A date instead of Unix seconds. |
| `tracking_settings` | `tracking: { opens, clicks }` | Two switches on each message. |
| `attachments[].type` | `attachments[].contentType` | Base64 or bytes, 5 MB in total. |
| `batch_id` | `emails.cancel(id)` | Cancel each message by its own id. |
| `asm.group_id` | `suppressions.add` | Unsubscribes go to one suppression list. |

Converter

## Paste your SendGrid code, get it back on Nextmail.

Pick where the code comes from and its language. Recognised keys are removed in your browser, and nothing you paste is kept.

From SendGrid

Your Nextmail code appears here

Paste a file, or load an example, then convert.

0 of 12,000 characters Recognised keys are removed before sending.

## Beyond the code, four more steps.

1. 01
   
   Add your sending domain
   
   Add it in Nextmail and publish the DNS records it lists. Sending starts once the signing record answers.
2. 02
   
   Create an API key
   
   Keys start with oe\_live\_ and carry only the scopes you give them.
3. 03
   
   Move your webhooks
   
   Create an endpoint for the events listed below and check the X-OpenEmail-Signature header on every request.
4. 04
   
   Bring the rest with one key
   
   In Migrations, choose From a provider and paste a SendGrid key. Suppressions, lists, contacts, templates and webhooks come across, and domains and keys arrive as a checklist.

[Read the SendGrid guide](https://nextmail.sh/docs/knowledge/developers/switch-from-sendgrid.md)

## Webhook events, renamed.

Each SendGrid event and the Nextmail event that replaces it. Every request carries one event, signed.

| SendGrid | Nextmail |
| --- | --- |
| `processed` | `email.sent` |
| `delivered` | `email.delivered` |
| `deferred` | `email.delivery_delayed` |
| `bounce` | `email.bounced` |
| `dropped` | `email.suppressed` |
| `spamreport` | `email.complained` |
| `open` | `email.opened` |
| `click` | `email.clicked` |
| `unsubscribe` | `contact.unsubscribed` |
| `group_unsubscribe` | `contact.unsubscribed` |
| `group_resubscribe` | `contact.resubscribed` |

## Moving from SendGrid, answered.

## Moving from somewhere else?

Every guide has the same converter, field map and checklist.

- [Resend Migration guide Keep your code on the compatible API, or convert it.](https://nextmail.sh/migrate/resend.md)
- [Postmark Migration guide Server tokens, message streams and templates.](https://nextmail.sh/migrate/postmark.md)
- [Mailgun Migration guide Domains, o: options and v: variables.](https://nextmail.sh/migrate/mailgun.md)

## Converted? Create the key it reads.

A workspace takes a minute. Add your domain, create an API key and set NEXTMAIL\_API\_KEY.

[Open mail](https://nextmail.sh/mail/inbox) [Get Started](https://nextmail.sh/signup.md)[Read the SDK docs](https://nextmail.sh/docs/sdk.md)
