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. Sign up in the console, or sign in if you have an account.
  2. Open API keys and click Generate. The key starts with sk_ and is shown once, so copy it then. Generating again replaces it.
  3. Send it on every request as Authorization: Bearer sk_....
A missing, invalid or revoked key returns 401 with a code and a registerUrl, except on POST /send, which returns 403; see Errors. Keep the key on your server: a key in frontend code is a key anyone can use against your rate limit. The Console page lists what else you can manage there.

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