Bouncewise

Bouncewise › Guides › Postmark webhooks: events, retries, security and IPs

Postmark guide

Postmark webhooks: events, retries, security and IPs

By the Bouncewise team · Updated · 4 min read · How we check guides

Short answer

Postmark retries an outbound webhook (Delivery, Bounce, SpamComplaint, Open, Click, SubscriptionChange) only when your endpoint returns 5xx, 408 or 429 or the connection fails, at 1, 5, 10, 10, 10 and 15 minutes; any other 4xx drops the event. Inbound webhooks are separate: 10 retries from 1 minute up to 6 hours, stopped by a 403. Postmark doesn't sign webhooks, so protect the URL with basic auth, custom headers and its webhook IP addresses.

Webhook event types

Outbound webhooks belong to a message stream; you choose which triggers each one sends. The JSON's RecordType tells you which event arrived:

RecordTypeSent whenOptions
DeliveryThe receiving server accepted the message
BouncePostmark processed a bounce (see bounce types)IncludeContent adds the full bounce
SpamComplaintA recipient marked a message as spamIncludeContent
OpenA tracked message was openedPostFirstOpenOnly
ClickA tracked link was clicked
SubscriptionChangeAn address was added to or removed from the stream's suppression list
Inbound (no RecordType trigger)Postmark parsed an email sent to your inbound addressOne URL per inbound stream, set in its Settings

Spam complaints, subscription changes and manual deactivations don't fire the Bounce webhook. If you want a single feed of addresses becoming inactive or active again, use SubscriptionChange: it carries SuppressSending, SuppressionReason and Origin (Recipient, Customer or Admin).

Retry schedules: outbound vs inbound

Outbound webhooksInbound webhook
Retried on5xx, 408, 429, timeouts and connection failuresAny response other than 200
Not retried onOther 4xx (400, 401, 403, 404, 405, 410, 422…)403
Schedule1, 5, 10, 10, 10, 15 minutes1, 5, 10, 10, 10, 15, 30 minutes, 1, 2, 6 hours (10 retries)
When retries run outThat event is droppedThe message shows as Inbound Error; you can retry it

Redirects are followed, up to 10 hops. Each outbound request carries X-PM-Retries-Remaining and an X-PM-Webhook-Trace-Id that stays the same across retries of one event.

The mistake to avoid: returning 401 or 404 while your app is mid-deploy loses outbound events for good. Return 503 if you want Postmark to try again.

Separately, Postmark watches each event type. If every delivery of one type fails, it emails a warning; if nothing gets through for 48 hours it disables that event type until you verify the webhook again, and events from that gap are never sent. Inbound failures are handled differently: retrying failed inbound messages.

Inbound messages list with failed, blocked and processed counts and a Retry all button
Inbound messages after the webhook failed.

Securing a Postmark webhook

Postmark's documentation says it does not currently support HMAC webhook signature verification, so there is no signing secret to check. Use these instead:

  • Basic auth in the URL: https://user:[email protected]/webhooks/postmark, or the HttpAuth object in the Webhooks API. Always over HTTPS.
  • A custom header through HttpHeaders, for example a long random value your endpoint compares in constant time.
  • An IP allowlist. Postmark lists these addresses for every webhook it sends (inbound, bounce, open and so on): 3.134.147.250, 50.31.156.6, 50.31.156.77, 18.217.206.57. The origin IP can change between attempts, and the list can change, so check Postmark's IPs for Firewalls page before relying on it.
  • Validate the payload: reject bodies without the RecordType and MessageID you expect.

Create and verify a webhook with the API

curl "https://api.postmarkapp.com/webhooks" \
  -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Postmark-Server-Token: $POSTMARK_SERVER_TOKEN" \
  -d '{
    "Url": "https://example.com/webhooks/postmark",
    "MessageStream": "outbound",
    "HttpAuth": {"Username": "postmark", "Password": "xxxx-xxxx"},
    "HttpHeaders": [{"Name": "X-Webhook-Secret", "Value": "xxxx-xxxx"}],
    "Triggers": {
      "Open": {"Enabled": false},
      "Click": {"Enabled": false},
      "Delivery": {"Enabled": true},
      "Bounce": {"Enabled": true, "IncludeContent": false},
      "SpamComplaint": {"Enabled": true, "IncludeContent": false},
      "SubscriptionChange": {"Enabled": true}
    }
  }'

On create and edit, Postmark sends a test event for every enabled trigger and expects 200 from each. If one fails, the call returns HTTP 422 with ErrorCode 1364, a Results array showing each trigger's StatusCode, and a summary such as 4/5 triggers verified successfully; nothing is saved. To register an endpoint that isn't live yet, send "Verify": false, then call POST /webhooks/{id}/verify when it is ready. An unverified webhook receives no events. GET /webhooks/{id}/statistics shows recent successes and failures per event type.

A handler that survives retries

  1. Check the basic auth or header, then store the raw body.
  2. Return 200 straight away and process from a queue. A slow response counts as a failure and causes a retry.
  3. Make processing idempotent: the same event can arrive twice. Key on X-PM-Webhook-Trace-Id, or on RecordType plus MessageID plus the event's timestamp, since one message can produce several events.
  4. On a temporary failure of your own, return 500 or 503, never a 4xx.
  5. Branch on RecordType, and acknowledge types you don't handle with 200.

Timestamps in webhook payloads are ISO 8601, except an inbound message's Date, which keeps the sending server's format.

Questions

Does Postmark sign its webhooks?

No. Postmark doesn't support HMAC webhook signatures; it recommends basic HTTP authentication in the webhook URL combined with allowlisting its webhook IP addresses.

What IP addresses do Postmark webhooks come from?

Postmark's IPs for Firewalls page lists 3.134.147.250, 50.31.156.6, 50.31.156.77 and 18.217.206.57 for all webhooks. Check that page for changes before you lock a firewall down.

Does Postmark retry a webhook that returns 404?

Not for outbound events: any 4xx other than 408 and 429 is treated as permanent and the event is dropped. The inbound webhook retries everything except 403.

Can I get events that were missed while a webhook was disabled?

Not through the webhook; Postmark doesn't send them later. Fetch them from the API instead, for example the Bounce API or message details, for the period it was down.

Sources