Skip to main content

First, choose how you execute

The API always returns the best route. How that route reaches the chain is your choice, and it decides which guide you follow. The rest of this page follows the first path.

1. Get an API key

  1. Register and log in.
  2. Generate an API key. It starts with sk_.
  3. Send it on every request as Authorization: Bearer sk_....
A missing, malformed or revoked key returns 403, not 401. Keep the key on your server: a key in frontend code is a key anyone can use against your rate limit.

2. Quote

  • assetIn and assetOut are contract addresses (C...). The two above are XLM and USDC on mainnet.
  • amount is in stroops, the asset’s smallest unit (7 decimals for XLM and USDC).
  • protocols lists the venues to consider. GET /protocols?network=mainnet returns the accepted values. SDEX is only priced when sdex is in the list.
  • slippageBps is optional and defaults to 50 (0.5%).
The response carries amountIn, amountOut, the minimum you will accept (otherAmountThreshold), the routePlan and a platform field that says how the route executes: aggregator, router or sdex.

3. Build, sign and send

You can also submit the signed transaction through your own Soroban RPC or Horizon instead of /send. Build soon after you quote. Prices move, and if your partner fee changed in between, /quote/build returns 409: quote again and build from the new quote.

Testnet

Use the same base URL with ?network=testnet. Testnet quotes come only from Soroswap pools and carry no fee. Fund an account with Friendbot and mint test tokens at faucet.soroswap.finance.

Next