Overview

Integration

User guide

API reference

Webhooks

Email API

This endpoint is solely responsible for sending emails with Postmark through a specific server.

Send a single email Try → #

get

/email

Request headers

Content-Type required

application/json

Accept required

application/json

X-Postmark-Server-Token required

This request requires server level privileges. This token can be found on the Credentials tab under your Postmark server.

Example request with curl

curl "https://api.postmarkapp.com/email" \
  -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Postmark-Server-Token: server token" \
  -d "{From: 'sender@example.com', To: 'receiver@example.com', Subject: 'Postmark test', HtmlBody: '<html><body><strong>Hello</strong> dear Postmark user.</body></html>'}"

Body format

From string required

The sender email address. Must have a registered and confirmed Sender Signature.

To string required

Recipient email address. Multiple addresses are comma separated. Max 50.

Cc string

Cc recipient email address. Multiple addresses are comma separated. Max 50.

Bcc string

Bcc recipient email address. Multiple addresses are comma separated. Max 50.

Subject string

Email subject

Tag string

Email tag that allows you to categorize outgoing emails and get detailed statistics.

HtmlBody string required

If no TextBody specified HTML email message

TextBody string required

If no HtmlBody specified Plain text email message

ReplyTo string

Reply To override email address. Defaults to the Reply To set in the sender signature.

Headers array

List of custom headers to include.

TrackOpens boolean

Activate open tracking for this email.

TrackLinks string

Activate link tracking for links in the HTML or Text bodies of this email. Possible options: None HtmlAndText HtmlOnly TextOnly

Attachments array

List of attachments

Example body format

{
  "From": "sender@example.com",
  "To": "receiver@example.com",
  "Cc": "copied@example.com",
  "Bcc": "blank-copied@example.com",
  "Subject": "Test",
  "Tag": "Invitation",
  "HtmlBody": "<b>Hello</b>",
  "TextBody": "Hello",
  "ReplyTo": "reply@example.com",
  "Headers": [
    {
      "Name": "CUSTOM-HEADER",
      "Value": "value"
    }
  ],
  "TrackOpens": true,
  "TrackLinks": "None",
  "Attachments": [
    {
      "Name": "readme.txt",
      "Content": "dGVzdCBjb250ZW50",
      "ContentType": "text/plain"
    },
    {
      "Name": "report.pdf",
      "Content": "dGVzdCBjb250ZW50",
      "ContentType": "application/octet-stream"
    }
  ]
}

Response

To string

Recipient email address

SubmittedAt string

Timestamp

MessageID string

ID of message

ErrorCode integer

API Error Codes

Message string

Response message

Example response

HTTP/1.1 200 OK
Content-Type: application/json

{
	"To": "receiver@example.com",
	"SubmittedAt": "2014-02-17T07:25:01.4178645-05:00",
	"MessageID": "0a129aee-e1cd-480d-b08d-4f48548ff48d",
	"ErrorCode": 0,
	"Message": "OK"
}

Send batch emails Try → #

post

/email/batch

Request headers

Content-Type required

application/json

Accept required

application/json

X-Postmark-Server-Token required

This request requires server level privileges. This token can be found on the Credentials tab under your Postmark server.

Example request with curl

curl "https://api.postmarkapp.com/email/batch" \
  -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Postmark-Server-Token: server token" \
  -d "[{From: 'sender@example.com', To: 'receiver1@example.com', Subject: 'Postmark test #1', HtmlBody: '<html><body><strong>Hello</strong> dear Postmark user.</body></html>'},{From: 'sender@example.com', To: 'receiver2@example.com', Subject: 'Postmark test #2', HtmlBody: '<html><body><strong>Hello</strong> dear Postmark user.</body></html>'}]"

Body format

From string required

The sender email address. Must have a registered and confirmed Sender Signature.

To string required

Recipient email address. Multiple addresses are comma separated. Max 50.

Cc string

Cc recipient email address. Multiple addresses are comma separated. Max 50.

Bcc string

Bcc recipient email address. Multiple addresses are comma separated. Max 50.

Subject string

Email subject

Tag string

Email tag that allows you to categorize outgoing emails and get detailed statistics.

HtmlBody string

If no TextBody specified HTML email message

TextBody string

If no HtmlBody specified Plain text email message

ReplyTo string

Reply To override email address. Defaults to the Reply To set in the sender signature.

Headers array

List of custom headers to include.

TrackOpens boolean

Activate open tracking for this email.

TrackLinks string

Activate link tracking for links in the HTML or Text bodies of this email. Possible options: None HtmlAndText HtmlOnly TextOnly

Attachments array

List of attachments

Example body format

[
  {
    "From": "sender@example.com",
    "To": "receiver@example.com",
    "Cc": "copied@example.com",
    "Bcc": "blank-copied@example.com",
    "Subject": "Test",
    "Tag": "Invitation",
    "HtmlBody": "<b>Hello</b>",
    "TextBody": "Hello",
    "ReplyTo": "reply@example.com",
    "Headers": [
      {
        "Name": "CUSTOM-HEADER",
        "Value": "value"
      }
    ],
    "TrackOpens": true,
    "TrackLinks": "None",
    "Attachments": [
      {
        "Name": "readme.txt",
        "Content": "dGVzdCBjb250ZW50",
        "ContentType": "text/plain"
      },
      {
        "Name": "report.pdf",
        "Content": "dGVzdCBjb250ZW50",
        "ContentType": "application/octet-stream"
      }
    ]
  }
]

Response

To string

Recipient email address

SubmittedAt string

Timestamp

MessageID string

ID of message

ErrorCode integer

API Error Codes

Message string

Response message

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "ErrorCode": 0,
    "Message": "OK",
    "MessageID": "b7bc2f4a-e38e-4336-af7d-e6c392c2f817",
    "SubmittedAt": "2010-11-26T12:01:05.1794748-05:00",
    "To": "receiver1@example.com"
  },
  {
    "ErrorCode": 0,
    "Message": "OK",
    "MessageID": "e2ecbbfc-fe12-463d-b933-9fe22915106d",
    "SubmittedAt": "2010-11-26T12:01:05.1794748-05:00",
    "To": "receiver2@example.com"
  }
]