Send an email
Send a message from a verified domain to one or more recipients.
/v1/emailAuthentication
Use Authorization: Bearer <key> with the email:send scope. X-Postmark-Server-Token and X-Prawnwire-Server-Token are also accepted.
Use a live key to send, or a test key to validate without queueing. The From domain must be verified on your organization and hosted on Prawnwire. Without a MessageStream, or with "outbound", the API carries transactional mail only; see Acceptable use. Newsletter mail uses the broadcast stream.
Body parameters
Send one JSON object. The combined UTF-8 bodies and decoded attachments can contain at most 10 MiB (10,485,760 bytes). There can be at most 50 unique recipients.
| Field | Description |
|---|---|
FromstringRequired | One address, optionally with a display name, on a verified domain hosted by Prawnwire for your organization. |
TostringRequired | Comma-separated addresses. At least one To recipient. At most 50 unique addresses across To, Cc and Bcc; addresses are lowercased and deduplicated in that order. |
CcstringOptional | Comma-separated carbon-copy recipients, included in the recipient limit. |
BccstringOptional | Comma-separated blind-copy recipients, included in the recipient limit. Not exposed to other recipients in the message headers. |
SubjectstringOptional | Up to 2,000 characters. Defaults to an empty string. |
HtmlBodystringOne body required | HTML body. Provide a nonempty HtmlBody, TextBody, or both. UTF-8 body bytes count toward the message size limit. |
TextBodystringOne body required | Plain-text body. Include it alongside HTML for clients that prefer plain text. |
ReplyTostringOptional | A valid address list for replies. Use this field, not a custom Reply-To header. |
TagstringOptional | Up to 1,000 characters. Use a stable label to filter activity. |
MetadataobjectOptional | Up to 10 fields. Keys are 1 to 20 characters; values are at most 80 characters. Strings are recommended. Numbers and booleans are converted to strings; objects, arrays and null values are refused. |
HeadersarrayOptional | Objects with Name and Value strings. Names contain 1 to 100 ASCII letters, digits or hyphens. Values are one line, up to 1,000 characters. Reserved headers are refused. |
AttachmentsarrayOptional | Objects with Name, base64 Content, optional ContentType and ContentID. Bodies plus decoded attachments must fit within 10 MiB (10,485,760 bytes). |
MessageStreamstringOptional | Omit it or use "outbound" for transactional mail. Use "broadcast" for newsletter mail from a verified newsletter subdomain; see Broadcast stream. Another value returns ErrorCode 1235. |
TrackOpensbooleanIgnored | Accepted but ignored. Open tracking is not implemented. |
TrackLinksstringIgnored | Accepted but ignored. Link tracking is not implemented. |
See Attachments for content fields and forbidden extensions, and Headers and metadata for reserved headers.
Response
HTTP 200 and ErrorCode: 0 mean accepted. To echoes the supplied To string, SubmittedAt is the submission time in UTC, and MessageID is the UUID to keep for activity lookups.
The server writes the email’s Message-ID as <uuid@from-domain> and writes its Date. The API’s MessageID is the UUID part. These headers cannot be replaced.
Partial suppression
The server queues the non-suppressed recipients and says OK. Not sent to suppressed recipients: ... in Message. To is still the original To field; do not treat it as a list of recipients actually sent to.
If every recipient is suppressed, nothing is queued and ErrorCode 406 is returned. If the remaining recipients do not fit the allowance, the message is refused with 405.
Broadcast stream
Set "MessageStream": "broadcast" to send newsletter mail through the same endpoint and through Batch. It needs Newsletters turned on for your organization, a postal address in Newsletters settings, and a From address on your verified newsletter subdomain (for example hello@news.example.com). Otherwise the request is refused with 1235, 300 or 400 and a Message naming what to set up.
Each recipient becomes a newsletter contact with consent source api; your API terms with your users are the consent record. Each recipient is a separate message with its own MessageID, listed in RecipientResults with its own ErrorCode. A recipient who unsubscribed, bounced or complained gets 406; when the monthly marketing send limit or the contact limit is reached the recipient gets 405. The other recipients are still sent. The top-level answer is HTTP 200 when at least one recipient was accepted, and 422 with the first recipient’s code otherwise.
Every broadcast carries List-Unsubscribe and List-Unsubscribe-Post headers and a footer with an unsubscribe link and your postal address. {{{ pm:unsubscribe }}} in the HtmlBody or TextBody is replaced with the recipient’s unsubscribe URL. Broadcasts are delivered from Prawnwire’s marketing servers, signed for your newsletter subdomain, and paced while those servers warm up, so delivery can wait for the next day’s quota.
The subject and link domains are checked against the acceptable use policy and link blocklists. A violation returns 300 with the reason. When a check cannot answer, the request returns HTTP 503 with ErrorCode 100 and nothing is queued or counted; retry it shortly.
Errors
Invalid fields return ErrorCode 300. A missing verified From domain returns 400; a verified but unhosted domain returns 401. Authentication, scope, rate, allowance, attachment, and stream errors are listed in Errors.
There is no documented idempotency key. If a connection ends after submission, check activity before resending to avoid duplicate mail.