Getting Started with Sendgrid
Disclaimer This is a portfolio sample. Please keep in mind that:
The sole purpose of this page is to showcase my understanding and practice of API documentation.
This content is not made from scratch. It is based on the publicely available official Sendgrid API documentation.
I focused on demonstrating a practical and user-friendly workflow on a best-effort basis.
This is content is intentionally incomplete and MUST NOT be used for production projects.
If you need a comprehensive documentation, please check the available official Sendgrid API documentation.
Overview
There are several ways you can get started with the SendGrid API. The following 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 implementations for the following libraries:
First Steps
Before you can start using the API, complete the following steps:
Building Your API Call
Prerequisites
Curl installed on your machine.
Sender Authentication set up in your account.
Active API key. Basic Authentication is no longer accepted.
A Sendgrid API call consists of a host, an authentication header, and a request. When building your API call remember that:
The host for Web API v3 requests is always
https://api.sendgrid.com/v3/.The Authorization header must include an API Key.
Submit your payload to a resource using JSON format for
POSTandPUTrequests.Total message size (message, headers, and attachments) must not exceed 20MB.
Do not use IP addresses. Set your server host to
https://api.sendgrid.com/v3/instead to avoid unexpected interruptions due to a change in the SendGrid IPs.
Sending an Email Using the API
To send an email using the SendGrid API follow these steps:
Copy and paste the following curl code in a text editor:
Replace
<<YOUR_API_KEY>>with your API keyIn the
--dataparameter, add your specific information in the following keys:"to""from""reply_to""name""subject"Copy the code and paste it in your terminal.
Hit Enter.
Check the inbox of the address you specified as the `"to" email address and see your message.
Last updated