Skip to main content
POST
/
webhooks
Create Webhook
curl --request POST \
  --url https://app.lettr.com/api/webhooks \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Order Notifications",
  "url": "https://example.com/webhook",
  "auth_type": "basic",
  "auth_username": "user",
  "auth_password": "secret",
  "events_mode": "selected",
  "events": [
    "message.delivery",
    "message.bounce"
  ]
}
'
{
  "message": "Webhook created successfully.",
  "data": {
    "id": "webhook-abc123",
    "name": "Order Notifications",
    "url": "https://example.com/webhook",
    "enabled": true,
    "event_types": [
      "message.delivery",
      "message.bounce"
    ],
    "auth_type": "basic",
    "has_auth_credentials": true,
    "last_successful_at": null,
    "last_failure_at": null,
    "last_status": null
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.lettr.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

API key for authentication

Body

application/json

Request body for creating a webhook

name
string
required

Name of the webhook

Maximum string length: 255
Example:

"Order Notifications"

url
string<uri>
required

URL where webhook events will be sent

Maximum string length: 2048
Example:

"https://example.com/webhook"

auth_type
enum<string>
required

Authentication type for the webhook

Available options:
none,
basic,
oauth2
Example:

"basic"

events_mode
enum<string>
required

Whether to receive all events or only selected ones

Available options:
all,
selected
Example:

"selected"

auth_username
string

Username for basic authentication (required when auth_type is 'basic')

Maximum string length: 255
Example:

"user"

auth_password
string

Password for basic authentication (required when auth_type is 'basic')

Maximum string length: 255
Example:

"secret"

oauth_client_id
string

OAuth2 client ID (required when auth_type is 'oauth2')

Maximum string length: 255
oauth_client_secret
string

OAuth2 client secret (required when auth_type is 'oauth2')

Maximum string length: 255
oauth_token_url
string<uri>

OAuth2 token URL (required when auth_type is 'oauth2')

Maximum string length: 2048
events
enum<string>[]

List of event types to receive (required when events_mode is 'selected'). Fully-prefixed names such as message.delivery are canonical; short names (delivery) and the legacy engagament.* prefix are accepted for backwards compatibility and are normalised to the fully-prefixed form.

Available options:
message.injection,
message.delivery,
message.bounce,
message.delay,
message.out_of_band,
message.spam_complaint,
message.policy_rejection,
engagement.click,
engagement.open,
engagement.initial_open,
engagement.amp_click,
engagement.amp_open,
engagement.amp_initial_open,
generation.generation_failure,
generation.generation_rejection,
unsubscribe.list_unsubscribe,
unsubscribe.link_unsubscribe,
relay.relay_injection,
relay.relay_rejection,
relay.relay_delivery,
relay.relay_tempfail,
relay.relay_permfail
Example:
["message.delivery", "message.bounce"]

Response

Webhook created successfully

Response after creating a webhook

message
string
required

Human-readable response message

Example:

"Webhook created successfully."

data
object
required

View of a webhook