Featured

Email API Migration Guide: Twilio SendGrid to Elastic Email

by Ula Chwesiuk | Jul 17, 2024

Changing an email service provider can be challenging, but we’d like to show you it doesn’t have to be. The transition can be smooth and hassle-free. On the example of migrating from SendGrid to Elastic Email, we will walk you through all the important steps to get started, integrate with our email API, and start sending. You will learn about our API libraries, documentation, and differences in references.

Why developers are leaving SendGrid

In May 2025, Twilio announced the end of SendGrid's free plans. Email sending was paused on all free accounts after a 60-day transition, and Marketing Campaign features - templates, contact list management and automation - were removed. SendGrid has also been consolidating under the Twilio brand and domain.

If you were relying on a free SendGrid account, you need a paid plan or a new provider. Elastic Email's Email API has a permanently free tier covering 3,000 emails a month with no credit card required, and this guide covers moving your integration across.

TL;DR

To migrate from Twilio SendGrid to Elastic Email: export your SendGrid contacts, suppression list and templates first - free accounts over 100 contacts had theirs deleted permanently. Then create a free Elastic Email account, verify your sending domain via DNS, generate an API key in Settings, install one of the 12 official libraries, and map your SendGrid API calls using the comparison table below. SendGrid authenticates with a bearer token; Elastic Email uses an X-ElasticEmail-ApiKey header, and the payload structure differs. Run both providers in parallel while you warm up your domain, then cut over.

API Libraries

The easiest way to integrate with our email API is to use one of our API libraries and frameworks. We’ve prepared and constantly maintain downloadable libraries for 12 programming languages. Each of them includes authentication and installation instructions, a quick start guide, code samples, and other useful resources. Here are our libraries:

If you cannot find the library you’re looking for, let us know at contact@elasticemail.com

How to get started

Let us move on to the essential steps - how to set up your Elastic Email account, integrate with our email API, and start sending emails.
We also prepared comprehensive API documentation so that you can integrate with our email API and use it according to your sending needs. Looking at API documentation is the best way to see the difference between email service providers. That is why we prepared some of the most crucial API references for both Twilio SendGrid and Elastic Email:

API Name

Email Marketing platform | Elastic EmailEmail Marketing platform | Elastic Email
Introduction
IntroductionEmail API Onboarding
Authentication
AuthenticationAuthentication
Sending Emails
EmailsSending email
Managing Suppressions
SuppressionsSuppressions
Managing Templates
TemplatesTransactional Templates
Inbound Email Processing
Inbound RouteInbound Parse
Statistics
StatisticsStats

Signing up

To start your migration process, you need to sign up for an Elastic Email account first and choose the Email API product. Creating an account on our platform is completely free of charge, and you do not need to provide any credit card details during the registration. Once you sign up, you will receive a confirmation email to verify your account.

Setting up a sending domain

After creating your Elastic Email account, you need to add and verify your sending domain. To do it, you will need to log into your domain provider and adjust the DNS settings of your domain. For more information, check out our help article on how to verify your domain or watch our YouTube guide below:

Creating your API key

To start using our email API, you will need to authenticate yourself with an API key. To generate it, enter settings on your Elastic Email account and go to Settings->Manage API Keys->Create.

At this point, you can set custom permissions and optional access for your API key.

After creating your API key, please keep it safe, as you will need your API key for every call you make in order to identify yourself and confirm your account’s credentials. 

Your API key should be sent inside the header with the parameter name ‘x-elasticemail-apikey’ and your API key as a value.

Installing API library

To make your migration process easier and quicker, we recommend downloading and installing a repository of the programming language you use. Both SendGrid and Elastic Email have a large collection of email API libraries and SDKs of many programming languages. Just like you integrated with SendGrid’s email API by installing a library or SDK, you need to do the same with Elastic Email. All our downloadable repositories are available on GitHub.

Let’s show you the installation process using JavaScript. For example, when you want to install the repository for Node.js.

Npm

To publish the library via npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install @elasticemail/elasticemail-client --save

Sending your first email

Let us first take a look at what sending an email via Twilio SendGrid API looks like:

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
  to: 'test@example.com',
  from: 'test@example.com', // Use the email address or domain you verified above
  subject: 'Sending with Twilio SendGrid is Fun',
  text: 'and easy to do anywhere, even with Node.js',
  html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
//ES6
sgMail
  .send(msg)
  .then(() => {}, error => {
    console.error(error);

    if (error.response) {
      console.error(error.response.body)
    }
  });
//ES8
(async () => {
  try {
    await sgMail.send(msg);
  } catch (error) {
    console.error(error);

    if (error.response) {
      console.error(error.response.body)
    }
  }
})();

If you want to send your first email via Elastic Email, you need to load the library, get client instance, use your newly generated Elastic Email API key, and create an instance of EmailsApi that will be used to send the email.

Based on the JavaScript example, here’s the whole code for sending an email to copy and paste:

const ElasticEmail = require('@elasticemail/elasticemail-client');

const client = ElasticEmail.ApiClient.instance;

const apikey = client.authentications['apikey'];
apikey.apiKey = "YOUR_API_KEY";

const emailsApi = new ElasticEmail.EmailsApi();
const emailData = {
    Recipients: [
        {
            Email: "johnsmith@domain.com",
            Fields: {
                name: "John"
            }
        }
    ],
    Content: {
        Body: [
            {
                ContentType: "HTML",
                Charset: "utf-8",
                Content: "<strong>Hi {name}!<strong>"
            },
            {
                ContentType: "PlainText",
                Charset: "utf-8",
                Content: "Hi {name}!"
            }
        ],
        From: "myemail@domain.com",
        Subject: "Example email"
    }
};

const callback = (error, data, response) => {
    if (error) {
        console.error(error);
    } else {
        console.log('API called successfully.');
        console.log('Email sent.');
    }
};
emailsApi.emailsPost(emailData, callback);

Email API migration guide: conclusion

Now you know all the essential steps for migrating from Twilio SendGrid to Elastic Email. If you have any questions about how to integrate with our email API, do not hesitate to contact our customer support team. They are available to you 24/7 via email at support@elasticemail.com or via live chat, which you can find in the bottom right corner of our website and platform. 
Haven’t you signed up for an Elastic Email account? Try it out and start sending emails with us today!

Enjoying this Content?

You can receive articles like this straight to your inbox.
Sign up for our newsletter and get a dose of email marketing knowledge every month!

FAQ

Yes. Twilio announced in May 2025 that email sending would be paused on all free SendGrid plans after a 60-day transition, and that Marketing Campaign features would no longer be available on free accounts. Accounts holding more than 100 contacts had those contacts permanently deleted.

Yes - Elastic Email's Email API includes a permanently free tier covering up to 3,000 emails a month, with no credit card required.

SendGrid authenticates with a bearer token and posts to its v3 mail send endpoint. Elastic Email uses an X-ElasticEmail-ApiKey header against https://api.elasticemail.com/v4. The request payload structures differ - see the comparison table.

No. Export your SendGrid templates as HTML and rebuild or import them in Elastic Email, and update personalization placeholders.

Yes, and it's often the fastest path - many applications only need new SMTP credentials and host details, with no code changes.

If you like this article, share it with friends:

FacebookXLinkedIn
Ula Chwesiuk

Ula Chwesiuk

Ula is a content creator at Elastic Email. She is passionate about marketing, creative writing and language learning. Outside of work, Ula likes to travel, try new recipes and go to concerts.

Eager to put this knowledge to some use?

Try one of our products!