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.
Deprecated, still supported
Section titled “Deprecated, still supported”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.
When v1 still fits
Section titled “When v1 still fits”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.
How a v1 order works
Section titled “How a v1 order works”- Quote.
POST /v1/quotesreturns aquoteIdandroutes[]: the native route alone when it quotes, otherwise the external routes that did. - Build.
POST /v1/deposit/buildwith thequoteIdand the chosenrouteIdreturns the wallet actions. - Execute. The user’s wallet runs the actions in order: switch chain, approve if needed, deposit.
- Submit.
PUT /v1/deposit/submitwith the deposit’s transaction hash creates the order and returns itsorderId. - Track. Poll
GET /v1/orders/by-id/{orderId}until the order isfilled,refundedorfailed.
The Quickstart runs these five steps in one browser script.
Endpoints
Section titled “Endpoints”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. |
Responses
Section titled “Responses”- Most responses are JSON.
POST /v1/quotes?mode=streamreturns NDJSON, icons are images, and an unknown order id returns a plain-text404. 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-idheader. Log it, and include it when you contact Khalani.