AllSwap

Quickstart

From zero to a tracked cross-chain swap in 5 curl commands. Plan on ~15 minutes. You will need an API key (request one here) and a wallet address on the destination chain.

Sandbox vs. live. Every key starts in sandbox mode — quotes are real, but swaps will not move on-chain funds. Flip the key to live in your dashboard when you are ready.

1. Get your API key

Every request is authenticated with two headers: X-Key-Id identifies the key (safe to expose), and Authorization: Bearer carries the secret (server-side only — never ship to a browser).

X-Key-Id: ak_live_yourapp
Authorization: Bearer sk_live_REPLACE_ME
Content-Type: application/json

Read more in Authentication — including rotation, scopes, and how to keep the secret out of your frontend bundle.

2. List supported tokens

Tokens are identified by their CAIP-19 asset id. This call returns every token currently routable, with chain, decimals, and a logo URL.

curl https://api.allswap.io/v1/tokens \
  -H "X-Key-Id: ak_live_yourapp" \
  -H "Authorization: Bearer sk_live_..."

3. Quote a swap

A quote is a non-binding price preview. We aggregate every supported route in parallel and return the best amount_out plus the route id you will commit to. Quotes expire after ~30 seconds.

curl -X POST https://api.allswap.io/v1/quote \
  -H "X-Key-Id: ak_live_yourapp" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "from":  "eip155:1/erc20:0xdac17f958d2ee523a2206206994597c13d831ec7",
    "to":    "tron:mainnet/trc20:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
    "amount": "1000000000",
    "sender":    "0xYourUserEvmAddress",
    "recipient": "TYourUserTronAddress"
  }'

amount is always in the smallest unit (USDT has 6 decimals → 1,000,000,000 = 1,000 USDT). route is opaque — we may surface Route A or Route B depending on liquidity at the moment. See Concepts → Routes.

4. Commit the swap

Pass the quoteId you just got back. We mint a one-time deposit address; your user sends funds there, and the swap kicks off automatically the moment the deposit lands.

curl -X POST https://api.allswap.io/v1/swap \
  -H "X-Key-Id: ak_live_yourapp" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "quoteId": "qt_01HW9..." }'
Deposit-address mode. No wallet SDK on your side. Your user just sends the exact depositAmount to depositAddress — we do the rest. Show them the address as both QR + monospace text.

5. Track status

Poll once every 10–15 seconds, or wire up a webhook (recommended). The status flows through a small state machine — see Concepts → Swaps.

curl https://api.allswap.io/v1/swap/sw_01HW9... \
  -H "X-Key-Id: ak_live_yourapp" \
  -H "Authorization: Bearer sk_live_..."

Where to go next

  • API reference — every field, every endpoint, every error.
  • Concepts — what routes, quotes, swaps, and fees actually mean.
  • Errors & rate limits — what to retry, what to surface to your user.
  • Pricing — free tier, paid tiers, when you need to talk to us.