Create Webhook

Create a new webhook endpoint to receive event notifications. A signing secret is generated automatically and returned only at creation time.

POST/webhooks

Resend 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

endpointstringrequired

The URL that will receive webhook events. Must be a valid HTTPS URL.

eventsstring[]required

Array of event types to subscribe to. At least one event is required.

Available event types:

  • email.sent — Email was sent
  • email.delivered — Email was delivered
  • email.bounced — Email bounced
  • email.complained — Recipient marked as spam
  • email.opened — Email was opened
  • email.clicked — Link in email was clicked
  • email.delivery_delayed — Email delivery was delayed
  • email.failed — Email failed to send
  • email.scheduled — Email was scheduled
  • email.received — Inbound email received
  • email.suppressed — Email was suppressed
  • domain.created — Domain was created
  • domain.updated — Domain status changed
  • domain.deleted — Domain was deleted
  • contact.created — Contact was created
  • contact.updated — Contact was updated
  • contact.deleted — Contact was deleted

Response Fields

objectstring

Always "webhook".

idstring

The webhook ID.

signing_secretstring

The 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

Response
{
  "object": "webhook",
  "id": "wh_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "signing_secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}