Skip to main content
Prerequisite: Your organization must be approved before it can quote. Swaps do not need a bank account. For onboarding your customers, see KYC Overview.
A swap exchanges one asset for another on the same chain. In v2 a swap is a quote and an order between two wallet payment accounts, the same way an onramp or offramp is. The destination can be the same wallet as the source, or another wallet on the same chain. Every call below runs for one organization, set as $ORGANIZATION_ID in the examples. Use your own organization’s id from GET /me, or a customer organization’s id when you swap for that customer. Register the wallets, quote and order under the same id. See Organizations in the route.
Swaps run on Stellar, Solana and Monad. The source and destination wallets must be on the same chain. To move the same token to a wallet on another chain, quote a cross-chain transfer instead. A quote between different tokens on different chains returns 400 invalid-request. Base, Polygon and Avalanche support onramps and offramps, not swaps.
Stellar swaps need a funded, trustlined wallet. The wallet must hold XLM for the network fee and a trustline for the asset it receives. An embedded wallet does not need this setup: its first onramp pays for its reserves, we pay its network fees and bill them at cost, and a token it has no trustline for arrives as a claim. See the Stellar, Solana and Monad chain guides for per-chain setup.

Swap flow

1

Discover assets

2

Register the wallets: POST /organization/{organizationId}/payment_account

3

Create a quote: POST /organization/{organizationId}/quote

4

Create the order: POST /organization/{organizationId}/order

5

Send the source asset

6

Track the order: GET /organization/{organizationId}/order/{id}

Sandbox tester

Sandbox API keys only. The tester sends requests from your browser with the API key you paste. Production keys do not work in it. In production, call these endpoints from your server.
The tester lists the organization’s wallet payment accounts and runs a swap between two of them: quote, order, funding, and the order’s progress. Each step shows its request and response, with a curl command to copy.
  • Embedded wallet source: paste the PKCS#8 PEM private key of the wallet’s signer key. Your organization needs embedded wallets turned on, and the wallet must already hold the source token. The tester signs the order’s funding authorization in your browser and, when the destination is the same wallet and ends claimable, prepares and signs the claim authorization too. The key never leaves the page.
  • Self-held wallet source: the tester shows fundingInstructions.destination. Send the funds or sign preparedTransaction with your own wallet, and refresh the funding instructions when the prepared transaction goes stale.