Skip to main content
POST /quote gives you a short-lived estimate. POST /swap creates the actual swap and returns deposit instructions.
Deposit details exist only after POST /swap. Never ask users to send funds based on a quote response.

The sequence

1

Load assets

Call GET /asset for supported networks, token symbols, decimals, logos, and memo requirements. Refresh regularly instead of hardcoding the list.
2

Validate the payout address

Call POST /address after the user enters a destination address. On memo-capable networks (XRP Ledger, Stellar, Cosmos), pass the destination memo when the payout needs one. The response field supportsMemo tells you whether the network can carry a memo. A memo on a network that doesn’t support memos fails with unsupported_memo.
3

Create a quote

Call POST /quote with the send asset, receive asset, and exact send amount. When the payout needs a memo, include it as to.memo so the estimate reflects a route that can carry it.
4

Create the swap

Call POST /swap with the quote ID and destination address. Pass the destination memo as destination.memo when the payout needs one. A memo set here overrides the to.memo from the quote. If no route for the pair can carry a memo, creation fails with unsupported_memo. Optionally pass refundAddress: an address on the sending network that receives the funds back if the swap is refunded. When omitted, LightSwap uses its configured network refund address.
5

Show deposit instructions

Display deposit.address, deposit.memo, deposit.amount, deposit.network, deposit.token, and deposit.deadline from the swap response.
6

Track the swap

Call GET /swap/{id} every 30 seconds until the status is terminal.

Retries

POST /swap is retry-safe per quoteId. Repeating the same create-swap call for a quote that already produced a swap returns the existing swap instead of creating a second one.

Amounts and rates

Amount fields are strings. Treat them as decimal strings, not JavaScript numbers. Quote amounts are estimates. The final received amount can move with market prices and network conditions before execution. See Fees and rates for the user-facing explanation.

Status emails

POST /swap accepts an optional notificationEmail. LightSwap emails that address when the swap reaches a final state: completed, failed, or refunded. Use it to keep your user informed without building notifications yourself.