Webhooks push real-time event notifications to your server whenever a settlement changes state. This is the recommended way to track settlement progress instead of polling.Documentation Index
Fetch the complete documentation index at: https://docs.keystoneos.xyz/llms.txt
Use this file to discover all available pages before exploring further.
How webhooks work
When a settlement changes state on-chain, KeyStone dispatches webhooks to all platforms involved in the settlement. Webhooks are delivered within seconds of the on-chain event.Local development
During development, your server runs onlocalhost which KeyStone can’t reach. The KeyStone CLI solves this by forwarding webhooks to your local server:
Setting up a webhook endpoint
1. Register the endpoint
Create a webhook endpoint in the KeyStone Dashboard under Settings > Webhooks. You need to provide:- URL - Your HTTPS endpoint that will receive webhook deliveries
- Event types - Which events to subscribe to (see patterns below)
2. Event type patterns
| Pattern | Matches |
|---|---|
* | All events |
settlement.* | All settlement events |
settlement.state.finalized | Only finalization events |
Webhook events
| Event | Trigger |
|---|---|
settlement.state.instructed | Settlement created on-chain |
settlement.state.compliance_checking | Compliance screening started |
settlement.state.compliance_cleared | All compliance checks passed |
settlement.state.awaiting_deposits | Ready for escrow deposits |
settlement.state.executing_swap | All deposits confirmed, auto-executing |
settlement.state.finalized | Settlement complete, assets delivered |
settlement.state.rolled_back | Settlement rolled back, deposits returned |
settlement.state.timed_out | Settlement timed out, deposits returned |
settlement.compliance.cleared | Compliance screening passed |
settlement.compliance.failed | Compliance screening failed |
settlement.compliance.flagged | Compliance flagged for manual review |
test.ping | Manual test via webhook endpoints API |
Webhook payload format
Every webhook delivery includes:Verifying signatures
Every webhook delivery includes anX-Keystone-Signature header containing an HMAC-SHA256 hex digest of the request body.
Secret rotation
Rotate your webhook secret in the KeyStone Dashboard under Settings > Webhooks by clicking Rotate Secret on the endpoint, or via the API:- Deliveries include both
X-Keystone-Signature(new secret) andX-Keystone-Signature-Previous(old secret) - Your server should verify against both headers
- After 24 hours, only the new secret is used
Testing
Send a test ping from the KeyStone Dashboard under Settings > Webhooks, or via the API:Best practices
- Return 200 quickly - Process webhooks asynchronously. Return a 200 status immediately and handle the event in a background job.
- Handle duplicates - Webhooks may be delivered more than once. Use the event ID or settlement state to make your handler idempotent.
- Verify signatures - Always verify the HMAC signature before processing. Reject unsigned or invalid requests.
- Monitor delivery logs - Check delivery logs in the KeyStone Dashboard or via the API:
Retry policy
Failed deliveries (non-2xx response or timeout) are retried with exponential backoff. After all retries are exhausted, the delivery is marked as failed in the delivery log.Webhook Event Catalog
See every event type with exact payloads and handler examples.
CLI Webhook Forwarding
Forward webhooks to localhost during development.