A webhook sends an HTTPS request to your server whenever something happens, so you do not have to keep asking the API. Webhooks are set up through the API, which is included in every paid plan; there is no webhook screen in the app.
Create an endpoint
curl -X POST https://tweak.email/api/v1/webhooks \
-H "Authorization: Bearer $TWEAK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/hooks/tweak","events":["email.bounced","email.complained"]}'
The response includes the endpoint's signing secret (starting whsec_). It is shown only once, so store it now. "events": ["*"] subscribes to everything. A team can have up to 10 endpoints. The URL must be a public HTTP or HTTPS address: localhost, private, loopback, link-local, multicast and reserved addresses, IP addresses written in a non-standard form (such as 2130706433 or 127.1), and URLs with a user name or password in them are refused with 422 and the code unsafe_webhook_url. The address is checked again before every delivery, and the delivery goes to the address that was checked.
GET /webhooks/event-types lists every event type you can subscribe to. See the API reference for updating, deleting and listing endpoints.
Events that are sent
| Event | When |
|---|---|
email.delivered |
A receiving server accepted an e-mail. |
email.opened |
A recipient opened an e-mail. The payload's is_machine_open tells you whether it was a machine open. |
email.clicked |
A recipient clicked a link. |
email.bounced |
An e-mail bounced or was dropped. |
email.complained |
A recipient reported an e-mail as spam. |
contact.created |
A contact was added: in the app, through the API, by an import, by a list's signup form, or from a data source when a campaign sends to it. |
contact.updated |
A contact was changed in the app or through the API (adding or removing its tags included), was included again in an import, signed up again through a form, or confirmed their subscription. |
contact.deleted |
A contact was deleted in the app or through the API, or erased at the person's request. |
contact.unsubscribed |
A contact unsubscribed. |
contact.bounced |
A contact's address bounced for good (a hard bounce, or repeated soft bounces) and was added to the suppression list. |
suppression.created |
An address was added to the suppression list, for any reason: a bounce, a spam complaint, an unsubscribe, or by hand in the app or through the API. An address that is already on the list does not send it again. |
campaign.sent |
A campaign finished sending. status is sent, or partial when some recipients could not be sent to. |
campaign.failed |
A campaign could not be sent. failure_reason says why. |
Contacts added or changed in bulk (an import or a batch API call) still get one event each. They are sent in the background shortly after the import or call finishes, so a large import can take a little while to arrive in full.
What a delivery looks like
Each request is a POST with a JSON body:
{
"id": "evt_...",
"type": "email.bounced",
"created_at": "2026-11-21T10:15:00+00:00",
"data": { "email": "jane@example.com", "campaign_id": 42, "contact_id": 1234, "...": "..." }
}
What data holds depends on the event:
contact.createdandcontact.updated: the contact, in the same shape the contacts API returns, including its tags and lists.campaign.sentandcampaign.failed: the campaign, asGET /campaigns/{id}returns it, includingsent_count,failed_countandfailure_reason.suppression.created: the suppression, asGET /suppressionslists it.- The
email.*events,contact.unsubscribedandcontact.bounced: the address, the campaign and contact ids and the time it happened.contact.bouncedaddsbounce_type(hardorsoft). For a transactional e-mail, the delivery events also carry themessage_idthatPOST /sendreturned and themetadatayou sent with it; both are null for other mail. contact.deleted: the contact'sid,email,erasedanddeleted_at. After an erasure at the person's request,erasedis true andemailis null: the address is not sent, because each delivery is kept in the endpoint's delivery history. Match the contact by itsid.
Headers include Tweak-Event-Type, Tweak-Event-Id and Tweak-Delivery-Attempt, so you can ignore an event you have already processed.
Verify the signature
Every request carries a Tweak-Signature header:
Tweak-Signature: t=1754835600,v1=9f86d0818...
To check it:
- Take
t(a Unix timestamp) andv1from the header. - Compute HMAC-SHA256 of the string
{t}.{raw request body}with your endpoint's secret, as a hex string. - Compare it with
v1using a constant-time comparison. - Reject requests whose
tis more than a few minutes old.
Use the raw body exactly as received, before any JSON parsing. POST /webhooks/{id}/test sends a webhook.test event so you can try your check, and POST /webhooks/{id}/rotate-secret issues a new secret.
Responses, retries and failures
- Answer with any 2xx status within 10 seconds. Redirects are not followed.
- A failed delivery is tried four times in all, after about 10 seconds, 1 minute and 5 minutes.
- After 20 events in a row fail every attempt, the endpoint is switched off. Fix your server, then switch it back on with
PATCH /webhooks/{id}and"is_active": true. GET /webhooks/{id}/deliveriesshows what was sent and the start of what your server answered: up to 500 characters of a 2xx answer, and up to 200 of any other.
When the plan does not include the API
Webhooks are part of the API. While your team's plan does not include it (for example after a free trial ends), no webhooks are sent; events from that time are not sent later. Your endpoints and their settings are kept, and deliveries start again as soon as the team is on a paid plan.