Swapped API
Swap 700+ coins across 20+ chains from your own app, bot or site. Free with a Swapped account β sign up below and get your API key in seconds.
Base URL: https://www.swapped.es/api/v1 Β· every request needs the header x-api-key: YOUR_KEY
Get your API key
Quickstart
A swap is three calls: find the coins, create the swap, then poll its status.
# 1. Find the assetIds curl https://www.swapped.es/api/v1/tokens -H "x-api-key: YOUR_KEY" # 2. Create a swap: 20 USDC (Solana) β LTC curl -X POST https://www.swapped.es/api/v1/swap \ -H "x-api-key: YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "originAsset": "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near", "destinationAsset": "nep141:ltc.omft.near", "amount": "20000000", "recipient": "YOUR_LTC_ADDRESS", "refundTo": "YOUR_SOLANA_ADDRESS" }' # β { "quote": { "depositAddress": "β¦", "amountOutFormatted": "0.33β¦", β¦ }, "trackUrl": "β¦" } # Send the coins to quote.depositAddress, then: # 3. Check the status curl "https://www.swapped.es/api/v1/status?depositAddress=DEPOSIT_ADDRESS" -H "x-api-key: YOUR_KEY"
JavaScript
const API = 'https://www.swapped.es/api/v1'; const swap = await fetch(`${API}/swap`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' }, body: JSON.stringify({ originAsset: 'nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near', // USDC on Solana destinationAsset: 'nep141:ltc.omft.near', // LTC amount: '20000000', // 20 USDC (6 decimals) recipient: 'YOUR_LTC_ADDRESS', refundTo: 'YOUR_SOLANA_ADDRESS', }), }).then(r => r.json()); console.log('Send to:', swap.quote.depositAddress, 'Β· track:', swap.trackUrl);
Try it
Get a live price estimate with your key (nothing is created). Log in above first.
Tokens
Every supported coin. Use assetId in the other calls and decimals to convert amounts.
[{ "assetId": "nep141:ltc.omft.near", "symbol": "LTC", "blockchain": "ltc", "decimals": 8, "priceUsd": 52.87 }, β¦]
Quote (estimate)
Same body as Create swap. Returns the price and amounts, but no deposit address β use it to show prices before the user commits.
Create swap
| Field | Type | Description |
|---|---|---|
originAsset | string | assetId of the coin the user sends. |
destinationAsset | string | assetId of the coin the user receives. |
amount | string | Amount to send in the smallest unit (e.g. "20000000" = 20 USDC with 6 decimals). |
recipient | string | Where the new coins go (address on the destination chain). |
refundTo | string | Where coins go back if the swap can't complete (address on the origin chain). |
slippageTolerance | number | Optional, basis points, 300β500 (default 300 = 3%). Also how much less the user can send and still swap. |
partnerFee | number | Optional β your own commission in basis points (1β100). See partner fees. |
partnerAddress | string | Required with partnerFee: your EVM wallet address (0xβ¦). |
user | string | Optional label for your own reference. |
Response
{
"quote": {
"depositAddress": "4aw8Z1d8β¦", // the user sends the coins here
"amountInFormatted": "20",
"minAmountIn": "19400000", // sending at least this still swaps
"amountOutFormatted": "0.3381",
"minAmountOut": "33480000",
"deadline": "β¦", // send before this time
"timeEstimate": 162 // seconds
},
"quoteRequest": { β¦ },
"trackUrl": "https://www.swapped.es/?track=4aw8Z1d8β¦",
"feeBps": 50, "partnerFeeBps": 0
}
depositAddress before the deadline (1 hour). Sending at least minAmountIn completes the swap; less is refunded to refundTo. Never send a different token.Status
Poll every 10β20 seconds until the status is final. Add &depositMemo=β¦ if the quote had a memo.
{ "status": "SUCCESS", "swapDetails": { "amountOutFormatted": "0.3381", "destinationChainTxHashes": [ β¦ ] } }
Earn with partner fees
Building a bot, wallet or shop? Add your own commission on top of ours and it's paid straight to you, in the same transaction.
{ β¦, "partnerFee": 50, "partnerAddress": "0xYourWalletAddress" } // you earn 0.5% of every swap
Swap statuses
| Status | Meaning |
|---|---|
PENDING_DEPOSIT | Waiting for the user's deposit. |
KNOWN_DEPOSIT_TX | Deposit seen, waiting for confirmations. |
INCOMPLETE_DEPOSIT | Less than minAmountIn arrived β the user can send the rest before the deadline, or it's refunded. |
PROCESSING | Swapping. |
SUCCESS | Done β coins sent to recipient. |
REFUNDED | Coins returned to refundTo (see swapDetails.refundReason). |
FAILED | Something went wrong β funds are refunded. |
Limits & errors
| Call | Limit per account |
|---|---|
| tokens, status | 120 / minute |
| quote | 60 / minute |
| swap | 50 / hour |
Errors return a non-2xx code and { "message": "β¦" }: 400 bad input, 401 missing or wrong API key, 429 too many requests, 502 no route for that pair right now. Need higher limits or help integrating? Email help@swapped.es or ask on our Discord.
Check live availability on the status page.