Create Webhook
Create a new webhook endpoint to receive event notifications. A signing secret is generated automatically and returned only at creation time.
POST
/webhooksResend Compatibility: Partial -- Postflare adds domain.created, domain.updated, domain.deleted, contact.created, contact.updated, and contact.deleted event types.
Requires a full_access API key.
Body Parameters
endpointstringrequiredThe URL that will receive webhook events. Must be a valid HTTPS URL.
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 deleted
Response Fields
objectstringAlways "webhook".
idstringThe webhook ID.
signing_secretstringThe signing secret for verifying webhook payloads (e.g. whsec_xxxxxxxxx). Store this securely.
curl -X POST 'https://api.postflare.app/webhooks' \
-H 'Authorization: Bearer re_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.app/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer re_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": "wh_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"signing_secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}