Free Token Swap API

No API keys. No accounts. Returns executable calldata. Built for AI agents and autonomous systems.

bash
$ curl "https://api.swapapi.xyz/v1/swap/1?\
  tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&\
  tokenOut=0x6B3595068778DD592e39A122f4f5a5cF09C90fE2&\
  amount=1000000000000000000&\
  sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
response.json
{
  "success": true,
  "data": {
    "status": "Successful",
    "tokenFrom": { "symbol": "ETH", "decimals": 18 },
    "tokenTo": { "symbol": "USDC", "decimals": 6 },
    "swapPrice": 2500.0,
    "priceImpact": 0.0012,
    "amountIn": "1000000000000000000",
    "expectedAmountOut": "2500000000",
    "tx": {
      "to": "0x...router",
      "data": "0x...calldata",
      "value": "1000000000000000000",
      "gas": "250000"
    }
  },
  "timestamp": "2026-03-12T00:00:00.000Z"
}
Try it yourself

Three steps to a swap

01

Send a GET request

Pass chain, tokens, amount, and sender address as query params. That's the entire interface — one GET request.

02

We find the best route

Your request is routed across DEX liquidity pools on 46 chains. Best price, lowest slippage, optimized gas.

03

You get calldata back

The response includes a ready-to-sign tx object. Submit it on-chain with any wallet or signer library.

Built for machines, usable by humans

No API keys

Every other swap API requires registration. AI agents can't sign up for accounts. We removed the barrier entirely.

No authentication

No OAuth, no headers, no tokens. A raw HTTP GET is all you need. Works from curl, from code, from an autonomous agent.

Returns calldata

You don't just get a quote — you get a complete transaction object ready to sign and broadcast. No extra steps.

Free forever

We make money on positive slippage, not on you. Your quoted price is our commitment — if we can do better, we keep the difference.

Live on 46 networks

Ethereum1
Arbitrum42161
Base8453
Optimism10
Polygon137
BSC56
Avalanche43114
Fantom250
Gnosis100
Linea59144
Scroll534352
Blast81457
Mantle5000
Mode34443
Sonic146
Berachain80094
Monad143
MegaETH4326
Manta169
Taiko167000
zkSync Era324
Polygon zkEVM1101
Arbitrum Nova42170
Celo42220
Cronos25
Kava2222
Metis1088
Filecoin314
Core1116
Boba288
Boba BNB56288
BTTC199
Haqq11235
Harmony1666600000
ThunderCore108
ZetaChain7000
SKALE Europa2046399126
Rootstock30
zkLink810180
ApeChain33139
Hemi43111
Tatara129399
Katana747474
HyperEVM999
Plasma9745
X Layer196

What you get back

Every response follows the same envelope. Parse success first, then read data.

GET /v1/swap/{chainId} — 200 OK
{
  "success": true,                                     // always check this first
  "data": {
    "status": "Successful",                            // "Successful" | "Partial" | "NoRoute"

    "tokenFrom": {                                     // input token metadata
      "address": "0xEeee...EEeE",
      "symbol": "ETH",
      "name": "Ether",
      "decimals": 18
    },
    "tokenTo": {                                       // output token metadata
      "address": "0xA0b8...eB48",
      "symbol": "USDC",
      "name": "USD Coin",
      "decimals": 6
    },

    "swapPrice": 2847.53,                              // exchange rate
    "priceImpact": 0.0012,                             // 0.12% — ratio, not percentage
    "amountIn": "1000000000000000000",                 // raw amount (BigInt as string)
    "expectedAmountOut": "284753...",                  // raw expected output

    "tx": {                                            // ready-to-sign transaction
      "from": "0xd8dA...6045",                         // your sender address
      "to": "0x...router",                             // router contract
      "data": "0x...calldata",                         // encoded swap calldata
      "value": "1000000000000000000",                  // ETH to send (for native swaps)
      "gas": "250000"                                  // estimated gas limit
    }
  },
  "timestamp": "2026-03-12T..."                        // ISO 8601
}
Error response — 400 / 429 / 502
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",                          // machine-readable error code
    "message": "Invalid token...",                     // human-readable description
    "details": {}                                      // optional additional context
  },
  "timestamp": "2026-03-12T..."
}

Query parameters

GET /v1/swap/{chainId}

chainId      path    required    Blockchain network ID (46 chains supported)
tokenIn      query   required    Input token address (0x...)
tokenOut     query   required    Output token address (0x...)
amount       query   required    Amount in raw units (no decimals)
sender       query   required    Sender address for tx.from
maxSlippage  query   optional    Slippage tolerance 0-1 (default: 0.005)