What you should use webhooks for
Webhooks are the canonical way to ingest outcomes into your product:
- Delivery/bounce/complaint feedback loops
- Open/click tracking events (if enabled)
- Suppression automation
Create webhook
POST/v1/webhooks
Creates a webhook endpoint. The signing secret is returned only once.
Store the secret securely; it is not returned again.
Body
target_urlstringRequiredHTTPS URL receiving webhook POSTs.
eventsstring[]RequiredEvent types to subscribe to.
enabledbooleanEnable/disable delivery.
curl -X POST "https://api.sendlib.com/v1/webhooks" \
-H "Authorization: Bearer $SENDLIB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target_url": "https://example.com/webhooks/email",
"events": ["delivery", "bounce"],
"enabled": true
}'{
"error": {
"message": "The request body is not valid JSON or is missing a required field."
}
}curl "https://api.sendlib.com/v1/webhooks" \
-H "Authorization: Bearer $SENDLIB_API_KEY"{
"error": {
"message": "Missing or invalid API key."
}
}Update webhook
PATCH/v1/webhooks/{id}
Patch a webhook endpoint by id.
Path parameters
idstringRequiredThe webhook id.
curl -X PATCH "https://api.sendlib.com/v1/webhooks/WEBHOOK_ID" \
-H "Authorization: Bearer $SENDLIB_API_KEY"{
"error": {
"message": "Missing or invalid API key."
}
}Delete webhook
DELETE/v1/webhooks/{id}
Delete a webhook endpoint by id.
Path parameters
idstringRequiredThe webhook id.
curl -X DELETE "https://api.sendlib.com/v1/webhooks/WEBHOOK_ID" \
-H "Authorization: Bearer $SENDLIB_API_KEY"{
"error": {
"message": "Missing or invalid API key."
}
}Rotate webhook secret
POST/v1/webhooks/{id}/rotate-secret
Rotates the signing secret and returns the new secret once.
The new signing secret is returned only once.
Path parameters
idstringRequiredThe webhook id.
curl -X POST "https://api.sendlib.com/v1/webhooks/WEBHOOK_ID/rotate-secret" \
-H "Authorization: Bearer $SENDLIB_API_KEY"{
"error": {
"message": "Missing or invalid API key."
}
}Send test webhook
POST/v1/webhooks/{id}/test
Triggers test webhook deliveries to validate your integration.
Path parameters
idstringRequiredThe webhook id.
curl -X POST "https://api.sendlib.com/v1/webhooks/WEBHOOK_ID/test" \
-H "Authorization: Bearer $SENDLIB_API_KEY"{
"error": {
"message": "Missing or invalid API key."
}
}Signing and verification
Every webhook endpoint has a signing secret. Store it securely — it's typically returned only when you create the webhook and when you rotate the secret.
To verify authenticity:
- Read the raw request body bytes
- Compute an HMAC using the signing secret
- Compare against the signature header (timing-safe compare)
Event payload
{
"type": "delivery",
"timestamp": "2026-02-05T12:34:56.789Z",
"message_id": "msg_01HP3GZK7E3D2C4P2J6Q1E9N2X",
"transmission_id": "f7e8d9c0-b1a2-4c3d-8e9f-0a1b2c3d4e5f",
"recipient": "user@example.com",
"provider": "gmail",
"outcome": {
"status": "delivered",
"reason": null
},
"meta": {
"tags": ["receipt"],
"tenant": "acme"
}
}Retries
Webhook delivery is retried when your endpoint returns a non-2xx response or times out.
Simulate events
Webhook Event Simulator
Generate realistic payloads and a demo signature.
{
"type": "delivery",
"timestamp": "2026-02-05T12:34:56.789Z",
"message_id": "msg_01HP3GZK7E3D2C4P2J6Q1E9N2X",
"transmission_id": "f7e8d9c0-b1a2-4c3d-8e9f-0a1b2c3d4e5f",
"recipient": "user@example.com",
"provider": "gmail",
"outcome": {
"status": "delivered",
"reason": null
},
"meta": {
"tenant": "acme",
"tags": [
"receipt"
]
}
}