Webhooks are global, not per user. You subscribe once and receive events for all
of your users. There’s no need to register a webhook per user, and you don’t pass a
user API key when managing webhooks. These are integrator endpoints, so they use your
integrator signing headers only.
Register an endpoint
Create a webhook by pointing it at an HTTPS URL on your backend and listing the events you want. Use"*" to subscribe to every current and future event.
Events
Subscribe to
"*" to receive all of these, including events added later.
Receiving a delivery
Spritz sends aPOST to your URL with a JSON body identifying what changed:
id is omitted for events whose subject is the user rather than a separate resource —
capabilities.updated is the case you are most likely to meet. Key your handler off
event and treat id as optional:
Verifying signatures
Each delivery is signed so you can confirm it came from Spritz and wasn’t modified in transit. Set a webhook secret withPOST /v1/integrator/webhook-secret, then verify
the Signature header against the raw request body using HMAC-SHA256. Always verify
against the raw body, before parsing JSON.
Best practices
Respond fast, process later
Respond fast, process later
Acknowledge with a
2xx immediately and hand off to a queue. Slow responses can
trigger retries and duplicate processing.Make handlers idempotent
Make handlers idempotent
Retries mean the same event can arrive more than once. Deduplicate on the resource
id. See Idempotency.Don't rely on event order
Don't rely on event order
Events are dispatched concurrently and are not ordered.
onramp.completed can
arrive before onramp.created for the same on-ramp, and does so most often when the
two transitions happen close together.The payload carries no timestamp, so order cannot be reconstructed from the event
alone. Key your handler off the resource id, fetch current state from the API, and
make each handler safe to run regardless of what has already been processed for that
resource — including the case where the first event you ever see for a resource is
its last one.Treat events as triggers, not truth
Treat events as triggers, not truth
On receipt, fetch the current resource from the API to get authoritative state
rather than relying solely on the event body.