Getting Started with Sendgrid

triangle-exclamation

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:

  1. Create a SendGrid accountarrow-up-right.

Building Your API Call

circle-info

Prerequisites

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/.

  • Submit your payload to a resource using JSON format for POST and PUT requests.

  • 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:

  1. Copy and paste the following curl code in a text editor:

  1. Replace <<YOUR_API_KEY>> with your API key

  2. In the --data parameter, add your specific information in the following keys:

    "to" "from" "reply_to" "name" "subject"

  3. Copy the code and paste it in your terminal.

  4. Hit Enter.

  5. Check the inbox of the address you specified as the `"to" email address and see your message.

Last updated