Webhooks
PineMail POSTs a signed JSON event to your HTTPS URL when a transactional email changes state. Configure endpoints in the dashboard or through the REST API. Production URLs must be HTTPS.
Events
Subscribe to one or more of these keys. Inbox compose and inbound mail do not emit these events today. They apply to messages sent through POST /v1/emails.
| Event | When |
|---|---|
email.queued | Accepted and waiting on the send worker. |
email.sending | Handed to SES. |
email.sent | SES accepted the message. |
email.delivered | Recipient MTA accepted it (SES configuration set + SNS). |
email.bounced | Hard or soft bounce from SES. |
email.complained | Recipient marked the message as spam. |
email.failed | Send failed before or at SES. |
email.opened | The tracking image was loaded, when the project has open tracking on. At most one per minute per email. |
email.clicked | A link was clicked, when the project has click tracking on. event_payload.url is the link. |
webhook.test | Synthetic ping from POST /v1/webhooks/{id}/test, or Send test on the webhook's page. |
Payload
Every delivery is a JSON object with id, type, created_at, and data. Respond with any 2xx within 10 seconds. Bodies larger than 4 KB are stored truncated on the delivery log.
Signature
Each request includes X-Mail-Signature: t=<unix>,v1=<hex>.v1 is HMAC-SHA256 of "<unix>.<raw_body>" using the webhook secret (whsec_...), shown once at create time. Reject timestamps older than 5 minutes.
Headers
Content-Type: application/jsonUser-Agent: PineMail-Webhooks/1.0X-Mail-Signature: t=…,v1=…
Retries
Non-2xx and network errors retry up to 12 attempts with exponential backoff starting at 30 seconds (about 17 hours). A successful delivery is never sent twice. Disabled endpoints stop retrying and mark the row failed.
When every attempt to an endpoint has failed for 5 days, PineMail turns the webhook off and the project's owner gets a notification.
The webhook then shows enabled: false and disabled_reason: "failing"; failing_since shows when the current run of failures began, and one delivered attempt clears it. Turning the webhook on again with PATCH {"enabled": true} starts the clock over.
Send failed deliveries again
A failed delivery can be sent again with a fresh set of attempts.
POST /v1/webhooks/{id}/deliveries/{delivery_id}/retry- Sends one.
POST /v1/webhooks/{id}/retry- Sends every failed delivery since
since(ISO 8601, default 7 days back, at most 30 days and 1,000 deliveries) and answers{"retried": n}.
The webhook must be on (409 otherwise), and test events are not resent. Both need webhooks:write. In the dashboard, Retry on a failed row and Resend failed above the list do the same.
Create and test
Creating a webhook returns the signing secret once. POST /v1/webhooks/{id}/test sends a webhook.test event immediately and records the HTTP status. Requires the webhooks:write scope.
In the dashboard, Send test on the webhook's page does the same and shows the answer.
Manage
GET /v1/webhooks- Lists endpoints.
GET /v1/webhooks/{id}- Includes the last 20 deliveries.
PATCH- Accepts
url,events, andenabled. DELETE- Removes the endpoint.
In the dashboard, Edit on the webhook's page changes the URL and events, and the secret and the delivery history stay. Rotate the secret from the dashboard if it leaks. The API does not return it again.