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

API v1 overview

API v1 is the original Khalani swap and bridge API. One quote request asks several routes for a price at once: the native route, which settles through Khalani, and the external routes Across, deBridge and Glacis. It trades any token in its token list, across the chains in GET /v1/chains, and it takes no API key.

v1 is maintained but gets no new features. Existing integrations keep working, since every endpoint on these pages is live and v1 runs alongside v2 on the same host. New integrations should use the Khalani API (v2), starting with its Quickstart.

Some v1 use cases have no v2 path today. Keep v1 for them, alongside v2 if you like, when you need:

  • Volatile tokens, such as ETH. v2 trades a short list of tokens today; volatile tokens are planned.
  • The chains only v1 serves: Optimism, Avalanche, Linea, 0G, BNB Smart Chain, Unichain, Monad, Berachain, Mantle, Katana, ZKsync Era, Abstract, Jovay, Solana and Bitcoin.
  • External routes (Across, deBridge, Glacis) for pairs the native route does not serve.
  • A deposit address on an EVM source chain, so that any wallet can fund the order with a plain transfer.
  • Server-side broadcast of a transaction the user signed.
  • Streaming quotes as NDJSON.
  • Token search, wallet balances, autocomplete and chain metadata.

Migrate to v2 maps every v1 endpoint to its v2 counterpart, where there is one.

  1. Quote. POST /v1/quotes returns a quoteId and routes[]: the native route alone when it quotes, otherwise the external routes that did.
  2. Build. POST /v1/deposit/build with the quoteId and the chosen routeId returns the wallet actions.
  3. Execute. The user’s wallet runs the actions in order: switch chain, approve if needed, deposit.
  4. Submit. PUT /v1/deposit/submit with the deposit’s transaction hash creates the order and returns its orderId.
  5. Track. Poll GET /v1/orders/by-id/{orderId} until the order is filled, refunded or failed.

The Quickstart runs these five steps in one browser script.

The base URL is https://api.hyperstream.dev.

Method Path Does
POST /v1/quotes Quotes from every route, as JSON or as an NDJSON stream. See Quotes.
POST /v1/deposit/build The wallet actions or deposit address for one route. See Deposit.
PUT /v1/deposit/submit Registers the deposit and creates the order. See Deposit.
GET /v1/orders/{address} Orders for a wallet, paginated. See Orders.
GET /v1/orders/by-id/{orderId} One order. See Orders.
GET /v1/tokens, /v1/tokens/search The token list and token search. See Tokens.
GET /v1/tokens/balances/{address} A wallet’s balances of listed tokens. See Tokens.
GET /v1/tokens/autocomplete/{keyword} Parses input such as 100 usdc on base into token suggestions. See Tokens.
GET /v1/chains, /v1/chain/{chainId}/icon Chain metadata and chain icons. See Chains.
  • Most responses are JSON. POST /v1/quotes?mode=stream returns NDJSON, icons are images, and an unknown order id returns a plain-text 404. See Handling exceptions for every error shape.
  • Every endpoint sends Access-Control-Allow-Origin: *, so a browser page can call it directly.
  • Quote, deposit and order responses carry an x-request-id header. Log it, and include it when you contact Khalani.