Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Getting started


To send your first email with the Twilio Email API, set up your account, authenticate your requests, and send a request to the Emails endpoint.


Prerequisites

prerequisites page anchor

Before you begin, ensure you have the following:


Authenticate your requests

authenticate-your-requests page anchor

The API uses HTTP Basic authentication. To authenticate, include a Basic Auth header using one of the following pairs:

  • Your Account SID and Auth Token
  • Your API Key SID and API Key Secret

Send your first email

send-your-first-email-1 page anchor
1
curl -X POST 'https://comms.twilio.com/v1/Emails' \
2
-H 'Content-Type: application/json' \
3
-d '{
4
"from": {
5
"address": "support@example.com",
6
"name": "Support Team"
7
},
8
"to": [
9
{
10
"address": "john.doe@example.com",
11
"name": "John Doe"
12
}
13
],
14
"content": {
15
"subject": "Your subject line",
16
"html": "<p>Your message content in HTML format.</p>",
17
"text": "Your message content in plain text."
18
}
19
}' \
20
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Response (202 Accepted):

Response (202 Accepted)

response-202-accepted page anchor
1
{
2
"operationId": "comms_operation_01h9krwprkeee8fzqspvwy6nq8",
3
"operationLocation": "https://comms.twilio.com/v1/Emails/Operations/comms_operation_01h9krwprkeee8fzqspvwy6nq8"
4
}

See Mail Send for more details on sending emails, including how to send to multiple recipients and use advanced features like templates and attachments.