Skip to main content
Ratio provides a REST API for partners to request FX quotes and verify on-chain settlements. The API follows a CeDeFi architecture — quoting and compliance run off-chain through this API, while settlement happens on-chain when the partner submits a transaction directly to the Kaia blockchain.
Ratio never takes custody of partner funds. The partner’s wallet signs and submits all settlement transactions. Funds move only at the moment of on-chain execution.

Base URLs

Endpoint paths (e.g. /v1/corridors) are appended to the base URL. The /api/router prefix is not part of the HMAC string-to-sign — sign /v1/... paths only.

Authentication

Every API request must be signed using HMAC-SHA256. This provides authentication, integrity verification, and replay protection.

Credentials

Issued during onboarding as a pair:
  • API Key — public identifier, sent in x-ratio-api-key.
  • API Secret — HMAC signing key. Server-side only, never transmitted after issuance. Store in a secret manager, Vault, KMS, or HSM — never in frontend code, public repos, logs, or CI output.

String-to-sign

Direct concatenation, no separators. GET requests:
POST requests (includes x-ratio-request-id):

API endpoints

There is no /v1/execute endpoint. Execution happens on-chain — the partner submits the commitFirmQuote transaction directly to the FxEngine contract using calldata returned by POST /v1/firm-quote.

Integration flow

1

Discover corridors

Call GET /v1/corridors to get corridor_id, token addresses, fee tiers, and risk state for each supported pair.
2

Get an indicative quote

Call POST /v1/quote with corridor_id, from_token, to_token, amount, and signer. Returns a reference price with full fee breakdown.
3

Approve the input token

One-time per token: from your wallet, approve() the FxEngine contract to spend the input token. Do this before requesting the firm quote you will execute — firm quotes expire after 60 seconds.
4

Request a firm quote

Call POST /v1/firm-quote to lock an executable rate. Returns an EIP-712 signed payload and ready-to-submit calldata.
5

Execute on-chain

Send a transaction to the FxEngine contract using the execution.calldata from the firm quote response. The swap settles atomically in that transaction.
6

Verify settlement

Call GET /v1/executions?quote=0x... to confirm settlement and retrieve execution details.
For a runnable end-to-end script covering every step, see the Full Example.

Response format

All responses follow a consistent envelope: Success:
Error:

Partner configuration

During onboarding, Ratio configures the following for each partner: