Webhooks API: signed account-event delivery
Register a public https endpoint for account events, verify its signed deliveries with a secret shown once, and review recent deliveries, on an admin key.
Webhooks deliver account events to an endpoint you run, a channel separate from the request-log export. They are managed at https://api.uplinkswitch.com/v1 with an admin key, and registering one needs the owner or an admin. The exports reference sends finished-request logs to your stack; this page covers account-event delivery and how to verify it.
Register an endpoint
POST /v1/webhooks registers a public https url and returns the endpoint with its signing secret, shown this one time. The endpoint object carries id (the prefix wh_ and 24 hex characters), the url, the events it receives (every account event), and created_at in Unix milliseconds. Use the signing secret to verify that a delivery came from the gateway before you act on it.
List, review and remove
GET /v1/webhooks lists the organization's endpoints, with the secrets never shown again. GET /v1/webhooks/deliveries returns recent delivery records, newest first, so you can see what fired and whether your endpoint accepted it. DELETE /v1/webhooks/{webhook_id} removes an endpoint.
Signature and events
Each delivery includes a timestamp and a signature. Compute HMAC-SHA256 over the timestamp, a period, and the exact raw body using the endpoint secret; compare its hexadecimal digest with the signature after the sha256= prefix.
Events are balance.low, balance.empty, key.budget_reached, key.limit_reached, topup.credited, payment.failed, incident.opened and incident.resolved. Delivery stops on a 2xx response, with at most three attempts: immediately, after two seconds and after eight seconds. Inspect the delivery records for outcomes.
Example
curl -X POST https://api.uplinkswitch.com/v1/webhooks \
-H "Authorization: Bearer sk-uplink-live-ADMIN..." \
-H "Content-Type: application/json" \
-d '{"url": "https://hooks.example.com/uplink"}'The response carries the new endpoint and its signing secret once; store the secret before you move on, because it is not shown again.
Status codes
A list, deliveries read or remove returns 200, and a registration 201. A URL that is not a public https endpoint is 400 invalid_request. A missing or invalid key is 401 invalid_api_key, and a key that is neither an owner nor an admin is 403 forbidden. An unknown endpoint id on delete is 404 not_found. Three endpoints already is 409 limit_reached.