There are several ways you can get started with the SendGrid API.
These instructions describe how to send your first email using cURL calls. This is one of many ways to send email with the SendGrid API - we also have PHP, Python, Node.js, Java, C#, Go, and Ruby libraries.
Before you can start using the API, you need to do the following:
cURL comes standard on Mac operating systems.
Your API call must have the following components:
https://api.sendgrid.com/v3/
Message size limit: The total message size should not exceed 20MB. This includes the message itself, headers, and the combined size of any attachments.
Please note that Basic Authentication is no longer accepted; you must use an API key.
To Send an email using the SendGrid API:
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header 'Authorization: Bearer <<YOUR_API_KEY>>' \
--header 'Content-Type: application/json' \
--data '{"personalizations":[{"to":[{"email":"john.doe@example.com","name":"John Doe"}],"subject":"Hello, World!"}],"content": [{"type": "text/plain", "value": "Heya!"}],"from":{"email":"sam.smith@example.com","name":"Sam Smith"},"reply_to":{"email":"sam.smith@example.com","name":"Sam Smith"}}'
If you have not yet set up Sender Authentication in your account, you may need to check your spam folder for the email you just sent.
Save time and feel confident you are set up for long-term success with Email Implementation. Our experts will work as an extension of your team to ensure your email program is correctly set up and delivering value for your business.
IMPLEMENTATION SERVICES →All responses are returned in JSON format. We specify this by sending the Content-Type
header. The Web API v3 provides a selection of response codes, content-type headers, and pagination options to help you interpret the responses to your API requests.
Get additional onboarding support. Save time, increase the quality of your sending, and feel confident you are set up for long-term success with SendGrid Onboarding Services.
For more information on SendGrid and where you can go from here, check out these pages:
Let us know how we’re doing! Please rate this page:
If you require immediate assistance from Twilio SendGrid, please contact our support team. If you’ve spotted a documentation problem, please open a GitHub Issue!
Please note, we cannot resolve account and login issues reported on GitHub. Contact support for account assistance.
Thanks for helping us improve our docs!