Create a webhook
Register an endpoint to receive HMAC-signed deliveries for the events named in event_types.
The response carries the signing secret ONCE. It is shown here and by POST /api/v1/webhooks/{id}/rotate-secret, and by nothing else — no endpoint reads it back, so store it now. A secret you have lost is replaced by rotating, not recovered.
Requires the webhooks:write scope — Create, edit, and delete your webhook endpoints.
API key authentication. Use a sk_* (FULL) or pk_* (SENDING_ONLY) key as the bearer token. Public keys (pk_*) are restricted to the email-send endpoints and the self-serve list subscribe/unsubscribe pair; every other endpoint — event tracking included — answers 403 for them. In scope terms (used by /api/v1/* operations): FULL keys hold every scope; SENDING_ONLY keys hold only emails:send.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Body for POST /api/v1/webhooks.
Response Body
application/json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://example.com/api/v1/webhooks" \ -H "Content-Type: application/json" \ -d '{ "url": "http://example.com", "event_types": [ "email.sent" ] }'{
"webhook": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"url": "string",
"event_types": [
"string"
],
"status": "ACTIVE",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
},
"secret": "string"
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
]
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
]
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
]
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
]
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
]
}