Skip to content
API v1 is deprecated. It stays supported, but new integrations should use the Khalani API (v3). See Migrate to v3.
API v1 · Deprecated

Migrate to v3

v3 is a different API, not a new version of the same calls. Where v1 asks several routes for a price and stores the quote, v3 asks solvers for one price, stores nothing until you create the order, and needs an API key. The order lifecycle, the error body and the fees change too. Plan the move as a new integration, and keep v1 for anything on the not on v3 yet list.

Read these v3 pages first: the Quickstart, Conventions, the Order lifecycle, Create orders and Fund orders. Every v3 field is in the API reference.

v1 v3 What changes
POST /v1/quotes, with or without ?mode=stream POST /v3/quote (API key) One solver price, as a list of options, instead of an aggregation of routes. Nothing is stored: each option has an id you create the order from, valid until expiresAt. No streaming.
POST /v1/deposit/build POST /v3/orders (API key) Creates the order and returns it, with the steps that fund it: EVM transactions, or one transfer to a deposit address on TRON or Stellar. Safe to repeat: the same request returns the same order.
PUT /v1/deposit/submit None v3 detects the deposit on-chain. There is no submit step and no server-side broadcast.
GET /v1/orders/{address} GET /v3/orders?account=… (API key) Scoped to your key. account is a CAIP-10 id. Also filters by status and asset, and syncs changes with sort=updatedAt.
GET /v1/orders/by-id/{orderId} GET /v3/orders/{id} (API key) Seven statuses, an outcome, and a summary of the payout and refund.
GET /v1/tokens, /v1/tokens/search, /v1/tokens/balances/{address}, /v1/tokens/autocomplete/{keyword} GET /v3/catalog (API key), its assets No search, balances or autocomplete.
GET /v1/chains, GET /v1/chain/{chainId}/icon GET /v3/catalog, its chains Each chain’s CAIP-2 id and name only.
None POST /v3/orders/{id}/actions New: refundTo signs a cancel, and your backend relays it.
None GET /v3/orders/{id}/changes New: an order’s history.
v1 v3
Access No key. X-Integrator-Id is optional and only selects fee configuration. X-API-Key on every call, from your backend.
Ids Chain ids and token addresses. CAIP-2 chain ids and CAIP-19 asset ids, taken from the catalog.
Price Several routes are asked; the native route wins whenever it quotes. One solver-backed price. A 200 means that size can be filled now.
Order id Returned by submit, after the deposit. Returned by order creation, before the deposit. Store it before the wallet signs.
Deposit The wallet runs the actions; you submit the hash. The wallet runs the order’s funding steps, from the payer on EVM. v3 finds the deposit on-chain.
States created → deposited → published → filled, or refund_pending → refunded, or failed. awaiting_funding → confirming → trading → settling → delivering → done, or expired. Polling stops when summary.pollAfterSeconds is null.
Partial fills No. An order fills or refunds. Yes. Settlement pays out the filled part and refunds the rest in one step.
Errors { message, name, details? } One shape, ApiError, with a recovery that says what to do next.
Rate limits Build: 60 per minute per wallet, 300 per IP. Quotes unlimited. Quote: 120 per minute per integrator, 600 per IP. Order creation: 60 and 300.
Your fee referrer and referrerFeeBps on the quote, plus the integrator configuration that X-Integrator-Id selects. A commission set in the on-chain integrator registry, read when the order publishes.

Don’t map the states one to one. A v3 order can be partly filled, and it settles once: the payout and the refund happen together, so there is no filled versus refunded split to mirror. Rewrite your status handling against the Order lifecycle.

  1. Get an API key, and send it as X-API-Key on every v3 call, from your backend. See API access.
  2. Load the catalog. Take chain and asset ids from GET /v3/catalog.
  3. Replace the quote. Call POST /v3/quote with send and receive. Pick an option whose requires you can meet, and show the user its display.receive and display.receiveMin.
  4. Replace the build. Send the option’s id to POST /v3/orders with the user’s accounts. Store the order id before anything else.
  5. Drop the submit. Have the wallet run the funding steps, once. On EVM, the deposit must come from the payer: a deposit from any other account isn’t credited.
  6. Replace tracking. Read GET /v3/orders/{id} after summary.pollAfterSeconds, until it is null. Keep syncing with GET /v3/orders?sort=updatedAt to receive later refunds: an expired order can become delivering or done.
  7. Replace error handling. Act on each error’s recovery, and log its requestId. See Errors and retries.

These work on v1 and have no v3 equivalent today. If your product depends on one, keep that flow on v1.

  • Volatile tokens. v3 trades a short list of tokens; volatile tokens are planned.
  • The chains only v1 serves: Optimism, Linea, 0G, BNB Smart Chain, Unichain, Berachain, Mantle, Katana, ZKsync Era, Abstract and Jovay.
  • External routes: Across and deBridge.
  • Deposit addresses on EVM sources.
  • Server-side broadcast of a signed transaction.
  • Streaming quotes.
  • Token search, balances and autocomplete.
  • Chain metadata: native currencies, RPC and explorer URLs, icons.