Sites WayDevelopers
API reference

Webhook endpoints

Where we send events, signed, so your server learns of every change.

Add a webhook endpoint

POST /v1/webhook_endpoints

The answer carries the signing secret, once.

Permission: webhooks:write

curl -X POST https://api.sw-staging.dev/v1/webhook_endpoints \
  -H "Authorization: Bearer sw_test_…" \
  -H "Content-Type: application/json" \
  -d '{"url":"string"}'

Request body

FieldTypeRequiredDescription
descriptionstringnoat most 200 characters
enabled_eventsarray of stringno'', a family such as 'payment.', or exact types; all events unless given. at most 32 items
urlstringyeshttps URL on the public internet. at most 2048 characters

201 — The endpoint

FieldTypeDescription
created_atstring (date-time)
descriptionstring or null
enabled_eventsarray of string
environmenttest, live
idstring
objectwebhook_endpoint
previous_secret_valid_untilstring (date-time) or null
secretstringShown once: verify signatures with it, store it safely
statusENABLED, DISABLED
updated_atstring (date-time)
urlstring

Errors answer with the error object.

List webhook endpoints

GET /v1/webhook_endpoints

Permission: webhooks:read

curl -X GET https://api.sw-staging.dev/v1/webhook_endpoints \
  -H "Authorization: Bearer sw_test_…"

200 — The endpoints

FieldTypeDescription
dataarray of object
data[].created_atstring (date-time)
data[].descriptionstring or null
data[].enabled_eventsarray of string
data[].environmenttest, live
data[].idstring
data[].objectwebhook_endpoint
data[].previous_secret_valid_untilstring (date-time) or null
data[].statusENABLED, DISABLED
data[].updated_atstring (date-time)
data[].urlstring
objectlist

Errors answer with the error object.

Retrieve a webhook endpoint

GET /v1/webhook_endpoints/{id}

Permission: webhooks:read

curl -X GET https://api.sw-staging.dev/v1/webhook_endpoints/pay_01M6XF0H2MAC63MEKQAT4K3AXF \
  -H "Authorization: Bearer sw_test_…"

Parameters

FieldTypeRequiredDescription
idstring (path)yesThe endpoint id

200 — The endpoint

FieldTypeDescription
created_atstring (date-time)
descriptionstring or null
enabled_eventsarray of string
environmenttest, live
idstring
objectwebhook_endpoint
previous_secret_valid_untilstring (date-time) or null
statusENABLED, DISABLED
updated_atstring (date-time)
urlstring

Errors answer with the error object.

Stop deliveries to an endpoint

POST /v1/webhook_endpoints/{id}/disable

Permission: webhooks:write

curl -X POST https://api.sw-staging.dev/v1/webhook_endpoints/pay_01M6XF0H2MAC63MEKQAT4K3AXF/disable \
  -H "Authorization: Bearer sw_test_…"

Parameters

FieldTypeRequiredDescription
idstring (path)yesThe endpoint id

200 — The endpoint

FieldTypeDescription
created_atstring (date-time)
descriptionstring or null
enabled_eventsarray of string
environmenttest, live
idstring
objectwebhook_endpoint
previous_secret_valid_untilstring (date-time) or null
statusENABLED, DISABLED
updated_atstring (date-time)
urlstring

Errors answer with the error object.

Resume deliveries to an endpoint

POST /v1/webhook_endpoints/{id}/enable

Permission: webhooks:write

curl -X POST https://api.sw-staging.dev/v1/webhook_endpoints/pay_01M6XF0H2MAC63MEKQAT4K3AXF/enable \
  -H "Authorization: Bearer sw_test_…"

Parameters

FieldTypeRequiredDescription
idstring (path)yesThe endpoint id

200 — The endpoint

FieldTypeDescription
created_atstring (date-time)
descriptionstring or null
enabled_eventsarray of string
environmenttest, live
idstring
objectwebhook_endpoint
previous_secret_valid_untilstring (date-time) or null
statusENABLED, DISABLED
updated_atstring (date-time)
urlstring

Errors answer with the error object.

Rotate the signing secret

POST /v1/webhook_endpoints/{id}/rotate_secret

A new secret signs from now on; the old one keeps verifying for previous_secret_valid_for_hours, so you can switch without missing a delivery.

Permission: webhooks:write

curl -X POST https://api.sw-staging.dev/v1/webhook_endpoints/pay_01M6XF0H2MAC63MEKQAT4K3AXF/rotate_secret \
  -H "Authorization: Bearer sw_test_…"

Parameters

FieldTypeRequiredDescription
idstring (path)yesThe endpoint id

Request body (optional)

FieldTypeRequiredDescription
previous_secret_valid_for_hoursintegernoHow long the old secret keeps verifying (default 24). min 0. max 168

200 — The new secret

FieldTypeDescription
created_atstring (date-time)
descriptionstring or null
enabled_eventsarray of string
environmenttest, live
idstring
objectwebhook_endpoint
previous_secret_valid_untilstring (date-time) or null
secretstringShown once: verify signatures with it, store it safely
statusENABLED, DISABLED
updated_atstring (date-time)
urlstring

Errors answer with the error object.

An endpoint's recent deliveries

GET /v1/webhook_endpoints/{id}/deliveries

Permission: webhooks:read

curl -X GET https://api.sw-staging.dev/v1/webhook_endpoints/pay_01M6XF0H2MAC63MEKQAT4K3AXF/deliveries \
  -H "Authorization: Bearer sw_test_…"

Parameters

FieldTypeRequiredDescription
idstring (path)yesThe endpoint id
limitinteger (query)noNewest first. default 50. min 1. max 100

200 — The deliveries

FieldTypeDescription
dataarray of object
data[].attemptsinteger
data[].created_atstring (date-time)
data[].delivered_atstring (date-time) or null
data[].event_idstring
data[].event_typestring
data[].idstring
data[].last_errorstring or null
data[].last_http_statusinteger or null
data[].next_attempt_atstring (date-time) or null
data[].objectwebhook_delivery
data[].statusPENDING, DELIVERED, FAILED, DISABLED
objectlist

Errors answer with the error object.

Send a delivery again

POST /v1/webhook_deliveries/{id}/resend

Permission: webhooks:write

curl -X POST https://api.sw-staging.dev/v1/webhook_deliveries/pay_01M6XF0H2MAC63MEKQAT4K3AXF/resend \
  -H "Authorization: Bearer sw_test_…"

Parameters

FieldTypeRequiredDescription
idstring (path)yesThe delivery id

202 — Queued again

FieldTypeDescription
idstring
statusPENDING

Errors answer with the error object.

On this page