Reference

Webhooks API

Manage webhook endpoints, rotate signing secrets, and inspect or replay delivery attempts.

On this page

Every request needs Authorization: Bearer with an API key. Errors use the shapes and codes in Errors and retry decisions. The OpenAPI document has the full schemas.

List webhook endpoints

GET /v1/webhook-endpoints (listWebhookEndpoints)

Lists the workspace's webhook endpoints and the events each one receives.

Needs an API key with the send scope.

curl --request GET "https://ternwire.com/v1/webhook-endpoints" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY"

Create webhook endpoint

POST /v1/webhook-endpoints (createWebhookEndpoint)

Registers an endpoint, up to 10 per organization including disabled endpoints. Returns 409 webhook_endpoint_limit_reached when full. An optional Idempotency-Key header makes a retry with the same body return the same endpoint and signing secret, and the same key with a different body returns 409 idempotency_conflict. If that endpoint was deleted since, the retry returns 409 idempotency_record_deleted.

Needs an API key with the send scope.

Request body

NameTypeRequiredNotes
urlstringYesA URL. URL.
eventTypesstring[]YesThe webhook event types the endpoint receives. Each one of email.delivered, email.bounced, email.complained, email.delayed, email.rejected, email.submitted, email.submission_unknown, email.received, email.opened, email.clicked, contact.subscription_confirmed, contact.unsubscribed, broadcast.started, broadcast.paused, broadcast.completed, broadcast.canceled, broadcast.failed.
curl --request POST "https://ternwire.com/v1/webhook-endpoints" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "url": "https://example.com/webhooks/ternwire",
    "eventTypes": [
      "email.delivered"
    ]
  }'

Update webhook endpoint

PATCH /v1/webhook-endpoints/{endpointId} (updateWebhookEndpoint)

Changes the endpoint's URL or events, or disables or enables it. A disabled endpoint receives no new events: events that occur while it is disabled are dropped, and its pending retries wait until it is enabled again.

Needs an API key with the send scope.

Path parameters

NameTypeRequiredNotes
endpointIdstringYes

Request body

NameTypeRequiredNotes
enabledbooleanYesDisabled endpoints receive no new events
curl --request PATCH "https://ternwire.com/v1/webhook-endpoints/{endpointId}" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "enabled": false
  }'

Delete webhook endpoint

DELETE /v1/webhook-endpoints/{endpointId} (deleteWebhookEndpoint)

Destroys the endpoint signing secret, and no new delivery is claimed after it returns. An already-claimed delivery may still be sent. The delivery attempt history stays listable until retention removes it.

Needs an API key with the send scope.

Path parameters

NameTypeRequiredNotes
endpointIdstringYes
curl --request DELETE "https://ternwire.com/v1/webhook-endpoints/{endpointId}" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY"

Rotate webhook endpoint signing secret

POST /v1/webhook-endpoints/{endpointId}/rotate-signing-secret (rotateWebhookEndpointSigningSecret)

Creates a new signing secret and returns it once. New events are signed with it at once, while retries of earlier events keep the old secret, so accept both until those finish.

Needs an API key with the send scope.

Path parameters

NameTypeRequiredNotes
endpointIdstringYes
curl --request POST "https://ternwire.com/v1/webhook-endpoints/{endpointId}/rotate-signing-secret" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY"

List webhook attempts

GET /v1/webhook-attempts (listWebhookAttempts)

Lists delivery attempts to your webhook endpoints, newest first, with the response each one got. Filter by endpoint or state.

Needs an API key with the send scope.

Query parameters

NameTypeRequiredNotes
cursorstringNo
limitintegerNoFrom 1 to 100. Default 25.
endpointIdstringNo
messageIdstringNo
curl --request GET "https://ternwire.com/v1/webhook-attempts" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY"

Get webhook attempt

GET /v1/webhook-attempts/{attemptId} (getWebhookAttempt)

Returns one delivery attempt with the history of every try.

Needs an API key with the send scope.

Path parameters

NameTypeRequiredNotes
attemptIdstringYes
curl --request GET "https://ternwire.com/v1/webhook-attempts/{attemptId}" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY"

Replay webhook attempt

POST /v1/webhook-attempts/{attemptId}/replay (replayWebhookAttempt)

Sends the same event to the endpoint again, with the same event id, so your handler can check that it deduplicates.

Needs an API key with the send scope.

Path parameters

NameTypeRequiredNotes
attemptIdstringYes
curl --request POST "https://ternwire.com/v1/webhook-attempts/{attemptId}/replay" \
  --header "Authorization: Bearer $TERNWIRE_API_KEY"