Create Webhook
Create a new webhook endpoint to receive event notifications. A signing secret is generated automatically. It is returned when you create the webhook and by Get Webhook; list responses omit it.
/webhooksResend Compatibility: Partial -- Postflare also accepts contact.topics.updated, suppression.added, suppression.removed, topic.created, topic.updated, and topic.deleted, which are not in Resend's event list.
Requires an API key with the webhooks:write permission.
Body Parameters
endpointstringrequiredThe URL that will receive webhook events. Must be a valid URL. The API validates only the URL format; it does not require https://, so an http:// URL passes request validation.
eventsstring[]requiredArray of event types to subscribe to. At least one event is required.
Available event types:
email.sent— Email was sentemail.delivered— Email was deliveredemail.bounced— Email bouncedemail.complained— Recipient marked as spamemail.opened— Email was openedemail.clicked— Link in email was clickedemail.delivery_delayed— Email delivery was delayedemail.failed— Email failed to sendemail.scheduled— Email was scheduledemail.received— Inbound email receivedemail.suppressed— Email was suppresseddomain.created— Domain was createddomain.updated— Domain status changeddomain.deleted— Domain was deletedcontact.created— Contact was createdcontact.updated— Contact was updatedcontact.deleted— Contact was deletedcontact.topics.updated— A contact's topic subscriptions changedsuppression.added— An address was added to the suppression listsuppression.removed— An address was removed from the suppression listtopic.created— Topic was createdtopic.updated— Topic was updatedtopic.deleted— Topic was deleted
Response Fields
objectstringAlways "webhook".
idstringThe webhook ID (UUID).
signing_secretstringThe signing secret for verifying webhook payloads (e.g. whsec_xxxxxxxxx). Store this securely.
curl -X POST 'https://api.postflare.dev/webhooks' \
-H 'Authorization: Bearer sk_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"endpoint": "https://example.com/webhooks",
"events": ["email.sent", "email.delivered", "email.bounced"]
}'// Direct API call (Resend SDK does not have webhook methods)
const response = await fetch('https://api.postflare.dev/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_xxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
endpoint: 'https://example.com/webhooks',
events: ['email.sent', 'email.delivered', 'email.bounced'],
}),
});
const data = await response.json();Response
{
"object": "webhook",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"signing_secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}