POST
/
email
curl --request POST \
  --url https://console.sendlayer.com/api/v1/email \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "From": {
    "name": "Paulie Paloma",
    "email": "paulie@example.com"
  },
  "To": [
    {
      "name": "Pattie Paloma",
      "email": "pattie@exampledomain.com"
    }
  ],
  "CC": [
    {
      "name": "Pattie Paloma CC",
      "email": "pattie.cc@exampledomain.com"
    }
  ],
  "BCC": [
    {
      "name": "Pattie Paloma BCC",
      "email": "pattie.bcc@exampledomain.com"
    }
  ],
  "ReplyTo": [
    {
      "name": "Pattie Paloma ReplyTo",
      "email": "pattie.reply@exampledomain.com"
    }
  ],
  "Subject": "This is the email subject",
  "ContentType": "HTML",
  "HTMLContent": "<html><body><p>This is a test email sent with the <a href=\\\"https://sendlayer.com\\\">SendLayer</a> API!</p></body></html>",
  "Tags": [
    "newsletter, daily"
  ],
  "Headers": {
    "X-Mailer": "test mailer",
    "X-Test": "test header"
  },
  "Attachments": [
    {
      "Content": "BASE 64 ENCODED STRING",
      "Type": "image/png",
      "Filename": "test.png",
      "Disposition": "attachment",
      "ContentId": "0"
    }
  ]
}'
{
  "MessageID": "8912e59e-ec88-bcd6-45dd-0012fe223ab6"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Below is the JSON payload required for sending a single email. Be sure to replace the example email addresses with valid email addresses in the From and To objects.

Note: The From email address must contain your sender domain, which is the domain that you’ve verified in SendLayer. For example, if you’ve authorized example.com you’ll need to use your-email@example.com. Additionally, you can send emails to multiple recipients by adding more objects to the To, CC,and BCC arrays within the specified limits. See our Getting Started guide for more details.

The body is of type object.

Response

200 - application/json

OK

A successfully delivered email returns the MessageID

A successfully delivered email returns the MessageID