For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a webhook

Create a new webhook for the account. The response includes a signing_secret that is used to verify webhook signatures.

post
Authorizations
Api-TokenstringRequired

API token in Api-Token header

Body
Responses
200

Webhook created successfully

application/json
post/api/webhooks
curl -X POST https://mailtrap.io/api/webhooks \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "webhook": {
      "url": "https://example.com/mailtrap/webhooks",
      "webhook_type": "email_sending",
      "payload_format": "json",
      "sending_stream": "transactional",
      "event_types": ["delivery", "bounce"],
      "domain_id": 435
    }
  }'
{
  "data": {
    "id": 1,
    "url": "https://example.com/mailtrap/webhooks",
    "active": true,
    "webhook_type": "email_sending",
    "payload_format": "json",
    "sending_stream": "transactional",
    "domain_id": 435,
    "event_types": [
      "delivery",
      "bounce"
    ],
    "signing_secret": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"
  }
}

Last updated

Was this helpful?