The Postmark API is built on REST principles. Authenticated users can interact with any of our URIs by using the specified HTTP request method. We enforce TLS encryption by issuing requests via HTTPS.
https://api.postmarkapp.com
All requests to Postmark’s API require you to authenticate yourself to the service. In order to do this you must send the correct HTTP header with the correct API token. Postmark has two types of API tokens:
X-Postmark-Server-Token
Used for requests that require server level privileges. Found from the API Tokens tab under your Postmark server. This token is accessible by Account Owners, Account Admins, and users who have Server Admin privileges on a server. X-Postmark-Account-Token
Used for requests that require account level privileges. Found from the API Tokens tab of your Postmark account. This token is accessible by the Account Owner and Account Admins.Each reference page for the different API endpoints will always specify which authentication header to use. The header name and value are case insensitive. In the case that you execute a request with wrong or missing headers, you will receive an HTTP Response 401 (Unauthorized).
Often when implementing your client library or when integrating an existing library into your application you may want to send test emails that don’t actually get delivered to the recipient. In most cases you just need to know if your data is valid. You can do this by passing the POSTMARK_API_TEST value in the X-Postmark-Server-Token header field.
When the Postmark API detects a problem with your request, it returns a JSON body with a numeric ErrorCode and a human-readable Message, and echoes the code in the X-PM-ApiErrorCode response header. Most input errors use HTTP 422, but some use a different status — for example, authentication failures return 401 and maintenance returns 503. Each code's status is listed in the HTTP column below. A single ErrorCode can cover several related messages.
{
"ErrorCode": 403,
"Message": "Invalid request field(s): 'From'."
}
The ErrorCode field can be used to programmatically detect the type of error. Here are the supported error codes:
| Code | HTTP | Message |
|---|---|---|
| Authentication | ||
| 10 | 401 | Request does not contain a valid Server or Account token, or the wrong token type was used for the endpoint. |
| Global | ||
| 100 | 503 | The Postmark API is offline for maintenance. |
| 101 | 500 | You encountered an error that shouldn't have occurred. The response includes an Error ID for support. |
| Sending — batch sends return per-message codes inside an HTTP 200 response | ||
| 11 | 422 | Multiple errors occurred. Inspect the Errors property for more information. |
| 12 | 404 | Bulk send not found. |
| 13 | 422 | Invalid pagination key. |
| 14 | 422 | This endpoint requires approval to access. Contact support to use the Bulk API. |
| 300 | 422 | Send validation. Covers many messages — zero recipients, invalid address, missing TextBody/HtmlBody, and recipient, metadata, attachment, or header limits. |
| 402 | 422 | Invalid JSON. |
| 403 | 422 | Invalid request field(s). |
| 406 | 422 | Inactive recipient. |
| 410 | 422 | You may only send up to 500 messages in a single batched request. |
| 411 | 422 | Attachment file type not allowed. |
| 412 | 422 | While your account is pending approval, all recipient addresses must share the same domain as the From address. |
| 413 | 422 | This account is not approved to send email. |
| 422 | 422 | Invalid Server or Account. |
| 1235 | 422 | The stream provided does not exist on this server. |
| 1236 | 422 | Sending is not supported for this stream type. |
| Templates | ||
| 601 | 422 | The source or destination server was not found (template push). |
| 1100 | 422 | Template list paging, or an invalid TemplateType or editorType query parameter. |
| 1101 | 422 | The request specifies neither TemplateId nor TemplateAlias, or the referenced template, alias, or layout was not found. |
| 1105 | 422 | A server's active-template limit would be exceeded by this request. |
| 1109 | 422 | No template data received. |
| 1120 | 422 | A required field is missing — Name, one of TextBody/HtmlBody, Subject, or TemplateModel. |
| 1121 | 422 | A field is too long — Name, Alias, HtmlBody, TextBody, Subject, or TemplateModel. |
| 1122 | 422 | Invalid TemplateType, alias empty/invalid/in-use, unparseable body, or a reserved top-level TemplateModel key. |
| 1123 | 422 | Template/send mutual-exclusion rules (layout vs. subject/body, templated vs. non-templated). |
| 1124 | 422 | No templates with aliases found to push, or the per-request push limit was exceeded. |
| 1125 | 422 | The template types don't match on the source and destination servers. |
| 1130 | 422 | The layout template cannot be deleted because dependent templates use it. |
| 1131 | 422 | Layout content-placeholder rules were not met. |
| Servers | ||
| 600 | 422 | Server-list paging — offset/count required or integer; up to 500 servers per call. |
| 602 | 422 | The specified inbound domain is already registered or in use on another server. |
| 603 | 422 | This server name already exists. |
| 604 | 422 | You do not have permission to delete servers using the API. |
| 605 | 422 | Unable to remove this server. Please contact support. |
| 606 | 422 | A supplied hook URL (Inbound, Bounce, Open, Delivery, or Click) is not valid. |
| 607 | 422 | Invalid server color. |
| 608 | 422 | Server name is invalid or missing, or an inbound domain containing postmarkapp.com was used. |
| 609 | 422 | No server data received. |
| 610 | 422 | We could not find an MX record pointing to the expected domain. |
| 611 | 422 | InboundSpamThreshold value is invalid. Use a number between 0 and 30. |
| 612 | 422 | The supplied TrackLinks option is not valid. |
| 613 | 422 | The supplied DeliveryType option is not valid. |
| 614 | 422 | Entitlement limit reached (inbound, stats, users, servers, streams, or domains). |
| 615 | 422 | Action is not supported. |
| Message activity, messages & bounces | ||
| 700 | 422 | Paging/parameter validation for messages, opens, clicks, and activity. |
| 701 | 422 | This message was not found, or cannot be bypassed or retried. |
| 702 | 422 | Could not bypass this blocked message. Please contact support. |
| 703 | 422 | Could not retry this failed message. Please contact support. |
| 1000 | 422 | Bounces query validation (non-negative, up to 500, count+offset, illegal bounce type). |
| 1001 | 422 | The bounce was not found, or its dump is no longer available. |
| 1002 | 400 | A bounceID parameter is required. |
| 1003 | 422 | Due to the type of bounce, this address cannot be reactivated. |
| Inbound rules / triggers | ||
| 800 | 422 | You may only request up to 500 triggers per call, plus parameter validation. |
| 809 | 422 | No trigger data received. |
| 810 | 422 | This inbound rule already exists. |
| 811 | 422 | Unable to remove this inbound rule. Please contact support. |
| 812 | 422 | This inbound rule was not found. |
| Message Streams | ||
| 1220 | 422 | You do not have permission to use the message streams API. |
| 1221 | 422 | The MessageStreamType associated with this request was invalid. |
| 1222 | 422 | A valid ID must be provided. |
| 1223 | 422 | A valid Name must be provided. |
| 1224 | 422 | The Name is too long. |
| 1225 | 422 | You have reached the maximum number of message streams for this server. |
| 1226 | 422 | The message stream for the provided ID was not found. |
| 1227 | 422 | The ID must be a non-empty string starting with a letter, up to 30 characters. |
| 1228 | 422 | A server can only have one inbound stream. |
| 1229 | 422 | You cannot archive the default transactional and inbound streams. |
| 1230 | 422 | The ID provided already exists for this server. |
| 1231 | 422 | The Description is too long. |
| 1232 | 422 | You cannot unarchive this message stream anymore. |
| 1233 | 422 | The ID must not start with the pm- prefix. |
| 1234 | 422 | The Description must not contain HTML tags. |
| 1237 | 422 | The ID is reserved. |
| 1238 | 422 | You do not have permission to use Custom Unsubscribe Handling for this stream. |
| 1239 | 422 | The UnsubscribeHandlingType provided is not supported for this stream type. |
| 1240 | 422 | The UnsubscribeHandlingType associated with this request is invalid. |
| 1241 | 422 | Stream is unable to be archived at this time. |
| Suppressions | ||
| 1400 | 422 | Parameter count should be an integer within the allowed range. |
| 1401 | 422 | Parameter count is required but was left out. |
| 1402 | 422 | Parameter offset should be an integer greater than or equal to zero. |
| 1403 | 422 | Parameter offset is required but was left out. |
| 1404 | 422 | Parameter SuppressionReason is invalid. |
| 1405 | 422 | Parameter Origin is invalid. |
| 1406 | 200 body | You do not have the required authority to change this suppression (per-item result). |
| 1407 | 422 | Something went wrong when processing the request. |
| 1408 | 422 / 200 body | An invalid email address was provided. |
| 1409 | 422 | A proper request body must be provided. |
| 1410 | 422 | You cannot provide more than the maximum number of suppressions for this request. |
| 1411 | 422 | Parameter emailAddress is required but was left out. |
| Sender Signatures & Domains | ||
| 500 | 422 | Signature/domain list paging (count/offset required or integer, up to 500). |
| 501 | 422 / 404 / 500 | Signature not found (422/404), or the signature has no DKIM info (500). |
| 502 | 422 | No update data or signature data received. |
| 503 | 422 | You can't use public domain emails or public domains. |
| 504 | 422 | This signature already exists, or a similar signature already exists. |
| 505 | 422 | This DKIM is already being renewed. |
| 506 | 422 | This Sender Signature has already been confirmed. |
| 507 | 422 | You do not own this Sender Signature. |
| 508 | 422 | This DKIM is not being renewed, or a key in a failed state cannot be rotated. |
| 510 | 422 | This domain was not found. |
| 511 | 422 | Invalid fields supplied. |
| 512 | 422 | Domain already exists. |
| 513 | 422 | You do not own this Domain. |
| 514 | 422 | Name is a required field to create a Domain. |
| 515 | 422 | Name field must be ≤ 255 characters. |
| 516 | 422 | Name format is invalid. |
| 520 | 422 | FromEmail is a required field to create a Sender Signature. |
| 521 | 422 | A field is too long (confirmation note, Name, FromEmail, ReplyToEmail, ReturnPathDomain, or CustomTrackingDomain). |
| 522 | 422 | A value is not a valid email address, domain, or subdomain. |
| 523 | 422 | You need to add a CNAME record that points to the expected value. |
| 614 | 422 | Signature/domain entitlement limit reached. |
| 709 | 500 | DKIM verification failed due to invalid configuration. Please contact support. |
| SMTP Tokens — new | ||
| 1450 | 422 | Parameter serverId is required but was left out. |
| 1451 | 422 | This token could not be found. |
| 1452 | 422 | A request body must be provided. |
| 1453 | 422 | This server was not found. |
| 1454 | 422 | A valid MessageStream is required, or the specified stream does not exist. |
| 1455 | 422 | The request must contain a valid and existing ServerID. |
| 1456 | 422 | Token length must be within the allowed range. |
| 1457 | 422 | Tokens cannot be used with inbound streams. |
| 1458 | 422 | A message stream's token limit would be exceeded by this request. |
| 1459 | 422 | A token cannot be issued for an archived stream scheduled for deletion. |
| 1460 | 422 | SMTP is currently disabled for the specified server. |
| Statistics API | ||
| 614 | 422 | You are not entitled to use the stats API. Upgrade to the next tier to add it. |
| 900 | 422 | A parameter should be a date/time value. |
| 1226 | 422 | The message stream for the provided ID was not found. |
| 1500 | 422 | The FromDate field cannot be older than one year ago. |
| 1501 | 422 | Parameter count should be an integer within the allowed range. |
| 1502 | 422 | Parameter FromDate must be older than ToDate. |
| GDPR API | ||
| 1300 | 422 | Empty request, or an invalid offset or count. |
| 1301 | 422 | Missing or incorrect data removal request ID. |
| 1302 | 422 | You don't have permission to process or review data removal requests through the API. |
| Webhooks API — new | ||
| 1350 | 422 | You cannot create a webhook using an archived MessageStream. |
| 1351 | 422 | You cannot create a webhook using an inbound stream. |
| 1352 | 422 | The webhook for the provided ID was not found. |
| 1353 | 422 | The webhook trigger is not supported on this message stream. |
| 1354 | 422 | The request must contain a valid Url field. |
| 1355 | 422 | A request body must be provided. |
| 1356 | 422 | A request ID must not be provided when creating a webhook. |
| 1357 | 422 | You cannot update the ID or MessageStream fields of a webhook. |
| 1358 | 422 | You must provide a valid HttpHeader Name. |
| 1359 | 422 | You have reached the maximum number of webhooks for this stream. |
| 1360 | 422 | You cannot update the integration. |
| 1361 | 422 | Invalid value provided for a field. |
| 1362 | 422 | Invalid value provided for status. Must be one of: verified, unverified. |
| 1363 | 422 | The Status field cannot be provided when creating or updating a webhook. |
| 1364 | 422 | Webhook verification failed; nothing was saved. Fix the endpoint and retry, or send ?verify=false to save it unverified. |