Skip to main content
Settlement status is available two ways: synchronously in the POST /v1/execute response, and asynchronously via webhook callback. Use webhooks to drive downstream processing without polling.

Webhook setup

Provide your webhook endpoint URL during onboarding. Ratio sends HTTP POST requests to this URL when events occur. Your webhook endpoint must:
  • Accept POST requests with Content-Type: application/json
  • Return HTTP 200 within 5 seconds to acknowledge receipt
  • Be idempotent — the same event may be delivered more than once
Return 200 immediately on receipt, then process the event asynchronously. This prevents timeouts from triggering Ratio’s retry logic.

Webhook events

settlement.confirmed

Fired when a swap settles on-chain. Includes full execution details.

settlement.failed

Fired when a swap execution fails. This is rare and typically caused by an on-chain revert.

quote.expired

Fired when a firm quote expires without being executed. Reserved inventory is released.

system.state_change

Fired when a corridor’s operating state changes (for example, from NORMAL to PROTECT).

Event types summary

Signature verification

Every webhook request includes a signature header:
Verify the signature before processing any event:
  1. Compute HMAC-SHA256 of the raw request body using your webhook secret.
  2. Compare the computed digest with the value in the X-Ratio-Signature header.
  3. Reject the request if the signatures do not match.
Always verify the signature. Do not process webhook payloads that fail signature verification.

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. You can query settlement status directly via GET /v1/system/state as a fallback.

Best practices

  • Verify the signature on every incoming request before processing the payload.
  • Make your handler idempotent. The same event may be delivered more than once due to retries.
  • Return 200 immediately, then process the event asynchronously to avoid triggering retries from slow processing.
  • Log the execution_id from every settlement.confirmed event for reconciliation and support escalation.