Skip to main content
POST
/
v1
/
webhooks
Create webhook subscription
curl --request POST \
  --url https://api.distranmail.com/v1/webhooks \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "https://api.your-domain.com/webhooks",
  "events": [
    "message.created"
  ],
  "description": "New message notifications",
  "metadata": {
    "environment": "production"
  }
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "url": "<string>",
  "events": [
    "message.created"
  ],
  "status": "active",
  "created_at": "2023-11-07T05:31:56Z",
  "description": "<string>",
  "secret": "<string>",
  "metadata": {},
  "updated_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
url
string<uri>
required

The URL where webhook events will be sent

events
enum<string>[]
required

List of events to subscribe to

Types of events that can trigger webhooks

Available options:
message.created,
message.updated,
message.sent,
message.delivered,
message.failed
description
string

Optional description of the webhook

metadata
object

Additional metadata for the webhook

Response

Webhook subscription created successfully

id
string<uuid>
required

Unique identifier for the webhook subscription

url
string<uri>
required

The URL where webhook events will be sent

events
enum<string>[]
required

List of events to subscribe to

Types of events that can trigger webhooks

Available options:
message.created,
message.updated,
message.sent,
message.delivered,
message.failed
status
enum<string>
required

Current status of the webhook subscription

Available options:
active,
inactive,
failed
created_at
string<date-time>
required
description
string

Optional description of the webhook

secret
string

Secret used to sign webhook payloads

metadata
object

Additional metadata for the webhook

updated_at
string<date-time>