Skip to main content
Ratio sends HTTP POST callbacks to your registered webhook URL when events occur. Use webhooks for real-time event-driven integration without polling.

Configuration

Event types

Payloads

settlement.confirmed

Sent when a swap is confirmed on-chain.

settlement.failed

Sent when a swap execution fails due to an on-chain revert.

quote.expired

Sent when a firm quote reaches its expiry_timestamp without being executed.

system.state_change

Sent when a corridor transitions between system states.

Signature verification

Every webhook request includes a signature header you must verify before processing the payload:
Compute the HMAC-SHA256 of the raw request body using your webhook secret, then compare the result against the header value. Reject any request where the signature does not match.

Retry policy

If your endpoint does not return HTTP 200 within 5 seconds, Ratio retries with exponential backoff: After 5 failed attempts the webhook is marked as failed. Query the execution status directly via the API as a fallback.

Best practices

Always verify the X-Ratio-Signature header before processing any payload. Discard requests that fail verification.
  • Make your handler idempotent. The same event may be delivered more than once. Use execution_id or quote_id to deduplicate.
  • Return 200 immediately, then process asynchronously. Your handler must respond within 5 seconds. Offload any slow processing to a queue or background task.
  • Log the full payload. Retain raw payloads for debugging and reconciliation.