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.

POST/webhooks

Resend 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

endpointstringrequired

The 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[]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
  • contact.topics.updated — A contact's topic subscriptions changed
  • suppression.added — An address was added to the suppression list
  • suppression.removed — An address was removed from the suppression list
  • topic.created — Topic was created
  • topic.updated — Topic was updated
  • topic.deleted — Topic was deleted

Response Fields

objectstring

Always "webhook".

idstring

The webhook ID (UUID).

signing_secretstring

The 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

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