API
Outbound webhooks
Outbound webhooks notify your systems when consent or deliverability events happen in MailPirate - so your CRM, warehouse, or support tools stay aligned.
Configure
- Open Settings → API & webhooks.
- Find Outbound webhooks.
- Set Webhook URL (HTTPS recommended).
- Choose which events to send.
- Rotate signing secret if you need a new secret, then store it securely.
- Save webhooks.
Delivery is asynchronous. Temporary failures are retried by MailPirate’s queue.
Events
| Event | When it fires |
|---|---|
profile.subscribed |
Profile becomes subscribed / confirmed |
profile.unsubscribed |
Profile unsubscribes |
email.bounced |
A bounce is recorded for a send |
email.complaint |
A spam complaint is recorded |
If you select an allow-list of events, only those are delivered.
Headers on each POST
| Header | Meaning |
|---|---|
Content-Type |
application/json |
X-MailPirate-Event |
Event name |
X-MailPirate-Timestamp |
Unix timestamp (string) |
X-MailPirate-Signature |
sha256=<hex> HMAC signature |
Verify signatures
To confirm the request came from MailPirate:
message = timestamp + "." + raw_request_body
signature = HMAC_SHA256(message, webhook_secret) as hex
header = "sha256=" + signature
Compare the header to your computed value in constant time. Reject requests with timestamps outside a short replay window (for example five minutes).
Example body
{
"event": "profile.subscribed",
"team_public_id": "01H...",
"occurred_at": "2026-11-18T12:00:00+00:00",
"profile_public_id": "01H...",
"email": "[email protected]",
"store_slug": "main"
}
Always expect at least:
eventteam_public_idoccurred_at
Bounce and complaint payloads include additional fields (reason / send context) when available. Build your consumer to ignore unknown keys so future additions do not break you.
Flow webhook steps
Flows can also POST from a Webhook step on the journey canvas (see Flows). Those deliveries use the same signature headers when a secret is configured, with:
| Extra detail | Meaning |
|---|---|
event |
Always flow.webhook |
X-MailPirate-Flow-Id |
Internal flow id (header) |
Body flow / profile / context |
Journey + profile snapshot |
Use account-level webhooks for consent/deliverability; use flow webhook steps for journey orchestration.
Implementation tips
- Respond quickly with
2xx; do heavy work asynchronously on your side - Key idempotency on
event+ profile/email +occurred_at(or any delivery id you store) - Keep the signing secret only on your server