Login Start for Free SendGrid Documentation / For Developers / Sending Email / Getting started with the SendGrid API On This Page Prerequisites for sending your first email with the SendGrid API How to send an API email Build your API call Send your email using the API Do you want expert help to get your email program started on the right foot? API response messages Next steps Rate this page: Getting started with the SendGrid API There are several ways you can get started with the SendGrid API. Prerequisites for sending your first email 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: Create a SendGrid account. Create an API Key. Make sure you have curl installed on your machine. cURL comes standard on Mac operating systems. How to send an API email Build your API call Your API call must have the following components: A host. The host for Web API v3 requests is always https://api.sendgrid.com/v3/ An Authorization header. An API Key must be included in the Authorization header. A request. When submitting data to a resource via POST or PUT, you must submit your payload in JSON. Message size limit: The total message size should not exceed 20MB. This includes the message itself, headers, and the combined size of any attachments. Send your email using the API 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"}}' Copy the curl example above. Paste the curl call into your favorite text editor. Copy your API key and paste it in the "Authorization" header. In the data section, specify the "to", "from", and "reply to" names and email addresses and enter a subject. Copy the code and paste it in your terminal. Hit Enter. Check the inbox of the address you specified as the "to" email and see your message! 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. Do you want expert help to get your email program started on the right foot? 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 → API response messages 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. Next steps For more information on SendGrid and where you can go from here, check out these pages: API Reference Sender Authentication Automating Subusers Rate this page: Need some help? We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow. Terms of Service Privacy Policy Copyright © 2021 Twilio Inc.