Webhook endpoints overview

How to register a webhook endpoint, handle its signing secret, test it, change it and remove it.

A webhook endpoint is a URL of yours that Localoy sends events to, for every partner connected to you. You manage endpoints through the API. Every call needs a provider key and ignores the partner header.

EndpointWhat it does
GET /webhooks/eventsLists the event types you can subscribe to.
POST /webhooksCreates an endpoint and returns its secret.
GET /webhooks, GET /webhooks/{id}Read endpoints.
PATCH /webhooks/{id}Changes URL, events or description, or enables and disables it.
GET / POST /webhooks/{id}/secretReveals or rotates the signing secret.
POST /webhooks/{id}/testSends a signed ping now.
DELETE /webhooks/{id}Deletes it and its delivery history.

The flow#

Setting up and maintaining an endpoint
Setting up and maintaining an endpointYour platformLocaloyYour receiver1. GET /webhooks/events2. 200 subscribable event names3. POST /webhooks { url, events }4. 201 endpoint + whsec_ secret5. Store the secret6. POST /webhooks/{id}/test7. Signed ping8. 2xx9. 200 data.ok trueMaintaining it10. PATCH /webhooks/{id}11. POST /webhooks/{id}/secret12. 200 new secret, old one stops13. Deploy the new secret now
  1. Your platform → Localoy: GET /webhooks/events
  2. Localoy → Your platform: 200 subscribable event names
  3. Your platform → Localoy: POST /webhooks { url, events }
  4. Localoy → Your platform: 201 endpoint + whsec_ secret
  5. Your platform → Your receiver: Store the secret
  6. Your platform → Localoy: POST /webhooks/{id}/test
  7. Localoy → Your receiver: Signed ping
  8. Your receiver → Localoy: 2xx
  9. Localoy → Your platform: 200 data.ok true
  10. — Maintaining it —
  11. Your platform → Localoy: PATCH /webhooks/{id}
  12. Your platform → Localoy: POST /webhooks/{id}/secret
  13. Localoy → Your platform: 200 new secret, old one stops
  14. Your platform → Your receiver: Deploy the new secret now
  1. Choose events. events must be a non-empty list of known names (400 invalid_events, with details.allowed); ping is not subscribable. The URL must be https and public.
  2. Create. One endpoint per URL per environment (409 webhook_endpoint_duplicate), at most 10 (409 webhook_endpoint_limit_reached). The create response and the rotate response are the only ones that carry the secret, besides GET …/secret.
  3. Test. The test is sent immediately, not queued, even to a disabled endpoint, and is not retried. It always answers 200; read data.ok for the outcome.
  4. Change. PATCH changes only what you send. environment is fixed (400 environment_immutable); create an endpoint in the other environment instead. Use status: "DISABLED" to pause deliveries.
  5. Rotate with care. The new secret applies at once and the old one stops verifying, so deploy it straight away. Deliveries that fail verification meanwhile are retried for about five minutes.
  6. Delete. Permanent, with the delivery history; queued retries are not sent. Deleting twice answers 404 webhook_endpoint_not_found.

Guide: Webhooks for providers. To verify signatures, see Verifying signatures.