Skip to main content
POST
/
v1
/
webhooks
Create Webhook
curl --request POST \
  --url https://api.example.com/v1/webhooks \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "<string>",
  "events": [
    "<string>"
  ],
  "description": "<string>"
}
'

Create Webhook

Create a new webhook endpoint to receive event notifications.
url
string
required
The URL to receive webhook events. Must be HTTPS.
events
string[]
required
Array of event types to subscribe to. Use * for all events.
description
string
Optional description for the webhook.

Request

curl -X POST https://api.lettr.dev/v1/webhooks \
  -H "Authorization: Bearer le_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhooks/lettr",
    "events": ["email.delivered", "email.bounced", "email.opened"]
  }'

Response

{
  "id": "wh_123abc",
  "object": "webhook",
  "url": "https://example.com/webhooks/lettr",
  "events": ["email.delivered", "email.bounced", "email.opened"],
  "secret": "whsec_xxxxxxxxxxxxxxxxxxxx",
  "status": "active",
  "createdAt": "2024-01-15T10:30:00Z"
}
The webhook secret is only shown once. Store it securely to verify incoming webhook signatures.

Available Events

EventDescription
*All events
email.*All email events
email.sentEmail accepted
email.deliveredEmail delivered
email.bouncedEmail bounced
email.openedEmail opened
email.clickedLink clicked
email.complainedMarked as spam
email.unsubscribedUnsubscribed