Managing the webhook endpoint by API
Everything the portal's Webhooks tab does, with the secret key. One endpoint per environment:
sk_test_* manages sandbox, sk_live_* production.
| Call | Does | Idempotency-Key |
|---|---|---|
GET /webhooks |
Read the endpoint (secret masked) |
- |
POST /webhooks |
Create ( 201, full whsec_* once) or change the URL (200, masked) |
required |
POST /webhooks/rotate-secret |
New secret, shown once |
required |
POST /webhooks/disable / enable |
Pause / resume delivery |
- |
POST /webhooks/test |
Send a signed webhook.test ping |
- |
GET /webhooks/deliveries |
Recent delivery attempts ( status, page, per_page) |
- |
Verified 2026-10-28:
GET /webhooksandGET /webhooks/deliveriesanswer404 webhook_not_foundwhen none is configured, and the documented shapes when one is (read in production, read only).POST /webhookswithout a key answers422 idempotency_key_required, and with anhttp://URL422 webhook_url_https. Create, rotate, disable, enable and test were not run: on a merchant with a live integration they would replace its URL or break its signature verification.
What to get right:
- The secret is shown once - on creation, on rotation, or on an idempotent replay of either
(
signing_secret_revealed: true). Every other response masks it. Store it before you do anything else. - Rotation breaks verification until your server has the new secret. Deploy the new secret first, then rotate - or accept both for the overlap.
- Same key + different body =
409 idempotency_conflict. Use a fresh key per action; reusing the creation key to rotate is the documented mistake. disabledmeans nothing is delivered, and nothing is queued for later. Recover what happened while paused withGET /payments.POST /webhooks/testanswers200even when your server failed. Readdeliveredandcodein the body:webhook_test_delivered,webhook_test_failed(your URL answered non-2xx) orwebhook_test_unreachable(timeout or connection error).response_bodyis a truncated copy of what your URL returned. The ping is not written to the delivery history.
A connector can now set itself up end to end: GET /me to show "Connected as {business_name}
(sandbox|live)", POST /webhooks with its own callback URL, store the whsec_*, then
POST /webhooks/test to prove the signature check accepts ROKI's real signature.
