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.

Free accountJSON over HTTPSCORS enabledNon-custodial Developer chat on Discord

Base URL: https://www.swapped.es/api/v1 Β· every request needs the header x-api-key: YOUR_KEY

Get your API key

Create accountLog in

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

GET/api/v1/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)

POST/api/v1/quote

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

POST/api/v1/swap
FieldTypeDescription
originAssetstringassetId of the coin the user sends.
destinationAssetstringassetId of the coin the user receives.
amountstringAmount to send in the smallest unit (e.g. "20000000" = 20 USDC with 6 decimals).
recipientstringWhere the new coins go (address on the destination chain).
refundTostringWhere coins go back if the swap can't complete (address on the origin chain).
slippageTolerancenumberOptional, basis points, 300–500 (default 300 = 3%). Also how much less the user can send and still swap.
partnerFeenumberOptional β€” your own commission in basis points (1–100). See partner fees.
partnerAddressstringRequired with partnerFee: your EVM wallet address (0x…).
userstringOptional 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
}
The user must send the origin coin on the origin chain to depositAddress before the deadline (1 hour). Sending at least minAmountIn completes the swap; less is refunded to refundTo. Never send a different token.

Status

GET/api/v1/status?depositAddress=…

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
The user pays our fee (0.5%) plus yours. Fees are collected on-chain and sent to your account automatically.

Swap statuses

StatusMeaning
PENDING_DEPOSITWaiting for the user's deposit.
KNOWN_DEPOSIT_TXDeposit seen, waiting for confirmations.
INCOMPLETE_DEPOSITLess than minAmountIn arrived β€” the user can send the rest before the deadline, or it's refunded.
PROCESSINGSwapping.
SUCCESSDone β€” coins sent to recipient.
REFUNDEDCoins returned to refundTo (see swapDetails.refundReason).
FAILEDSomething went wrong β€” funds are refunded.

Limits & errors

CallLimit per account
tokens, status120 / minute
quote60 / minute
swap50 / 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.