Webhooks API

Register webhook endpoints to receive real-time notifications about message events.

GET /v1/webhooks

List all registered webhook endpoints for the authenticated organization.

cURL
curl https://api.yoursend.dev/v1/webhooks \
  -H "Authorization: Bearer ys_live_..."
Response
{
  "webhooks": [
    {
      "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
      "url": "https://example.com/webhooks/yoursend",
      "events": ["message.sent", "message.delivered", "message.failed"],
      "is_active": true,
      "created_at": "2026-01-15T09:30:00.000Z"
    }
  ]
}

POST /v1/webhooks

Register a new webhook endpoint. Returns the HMAC signing secret — store it securely, it is only shown once.

FieldTypeRequiredDescription
urlstringYesHTTPS endpoint URL
eventsstring[]NoEvents to subscribe to. Defaults to message.sent, message.delivered, message.failed.
cURL
curl -X POST https://api.yoursend.dev/v1/webhooks \
  -H "Authorization: Bearer ys_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhooks/yoursend",
    "events": ["message.sent", "message.delivered", "message.failed", "message.bounced"]
  }'
Response (201)
{
  "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "url": "https://example.com/webhooks/yoursend",
  "events": ["message.sent", "message.delivered", "message.failed", "message.bounced"],
  "is_active": true,
  "created_at": "2026-01-15T09:30:00.000Z",
  "secret": "whsec_a1b2c3d4e5f6..."
}

Important: The secret is only returned at creation. Store it securely to verify webhook signatures. See the verification guide.

PATCH /v1/webhooks/:id

Update a webhook endpoint's URL, events, or active status. All fields are optional — only include what you want to change.

FieldTypeDescription
urlstringNew endpoint URL
eventsstring[]Replace subscribed events
is_activebooleanEnable or disable the webhook
cURL — update events
curl -X PATCH https://api.yoursend.dev/v1/webhooks/d290f1ee-... \
  -H "Authorization: Bearer ys_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "events": ["message.delivered", "message.failed", "message.bounced", "message.opened"]
  }'
cURL — disable
curl -X PATCH https://api.yoursend.dev/v1/webhooks/d290f1ee-... \
  -H "Authorization: Bearer ys_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "is_active": false }'
Response
{
  "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "url": "https://example.com/webhooks/yoursend",
  "events": ["message.delivered", "message.failed", "message.bounced", "message.opened"],
  "is_active": true,
  "created_at": "2026-01-15T09:30:00.000Z"
}

DELETE /v1/webhooks/:id

Permanently delete a webhook endpoint.

cURL
curl -X DELETE https://api.yoursend.dev/v1/webhooks/d290f1ee-... \
  -H "Authorization: Bearer ys_live_..."
Response
{ "deleted": true }

Webhook Events

EventDescriptionChannels
message.sentMessage accepted and sent to providerEmail, SMS, Voice
message.deliveredMessage confirmed deliveredEmail, SMS, Voice
message.openedRecipient opened the emailEmail
message.clickedRecipient clicked a linkEmail
message.bouncedEmail bounced (hard or soft)Email
message.failedDelivery failed or complaint receivedEmail, SMS, Voice
otp.verifiedOTP code verified successfullyEmail, SMS, Voice
otp.expiredOTP expired before verificationEmail, SMS, Voice
contact.suppressedContact auto-suppressed (bounce/complaint)Email
blast.completedBulk email blast finishedEmail
email.receivedInbound email receivedEmail