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": [
    "delivery",
    "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
  }
}

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
string[]

List of event types to receive (required when events_mode is 'selected')

Example:
["delivery", "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