Swaps

Quote a swap

Prices a swap on every route of a pair on Uniswap V4, 1inch Aqua, Orca and Raydium, best first, without signing anything or holding funds. Send a chain, two tokens and an amount, or name one Uniswap V4 pool or 1inch Aqua order with `venue`.

POST
/api/swap/quote

Authorization

ApiKeyAuth
X-API-Key<token>

Your API key. Authorizing a swap or opening a market takes a key issued to your integration, and the shared key the docs fill in reads and quotes only.

In: header

Query Parameters

chainId?integer

Only with venue aqua, and then required: the chain's numeric id, for example 8453. Every other body sends chainId in the body.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/api/swap/quote" \  -H "Content-Type: application/json" \  -d '{    "chainId": 8453,    "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",    "tokenOut": "0x4200000000000000000000000000000000000006",    "amountIn": "1000000",    "slippageBps": 50,    "maxPriceImpactBps": 500  }'

{  "chainId": 8453,  "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",  "tokenOut": "0x4200000000000000000000000000000000000006",  "tradeType": "exactIn",  "slippageBps": 50,  "maxPriceImpactBps": 500,  "best": {    "venue": "v4",    "poolId": "0x5622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e8639"  },  "routes": [    {      "status": "ok",      "route": {        "venue": "v4",        "poolId": "0x5622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e8639"      },      "feeBps": 30,      "amountIn": "1000000",      "amountOut": "398883266557098",      "minAmountOut": "396888850224313",      "maxAmountIn": "1000000",      "priceImpact": {        "lossBps": 31,        "warnBps": 500,        "refuseBps": 1500      },      "impactTier": "normal",      "v4": {        "router": "0x6fF5693b99212Da76ad316178A184AB56D299b43",        "poolKey": {          "currency0": "0x4200000000000000000000000000000000000006",          "currency1": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",          "fee": 3000,          "tickSpacing": 60,          "hooks": "0x5Aef2c787AFC743D20FD632D66391B2ccd5c68C0"        },        "swapDirection": "oneForZero",        "sqrtPriceX96": "3960994633772755407296098"      }    },    {      "status": "ok",      "route": {        "venue": "aqua",        "strategyId": "0x839948754096065617e6b7e0ac8475dfe305b7cb9ec9cd56e662cc578934204c"      },      "feeBps": 0,      "amountIn": "1000000",      "amountOut": "398700000000000",      "minAmountOut": "396706500000000",      "maxAmountIn": "1000000",      "priceImpact": {        "lossBps": 36,        "warnBps": 500,        "refuseBps": 1500      },      "impactTier": "normal",      "aqua": {        "router": "0x111111338c5091E8440b67B168bAe16a668AC0De",        "classId": "59523810852171421926281537532663362136339754404856535599205534763879943643212",        "aquaHash": "0x02eddcb2925b96845fec441d9d891ef11cfa1a350d5b1b1b3891ba753bf4e5ec",        "order": {          "maker": "0x49DEE5b551108591054d530F2EE4B978a9af6703",          "traits": "34375776492328245516372636174454222643939526697612042449213970252349210361856",          "data": "0x124000000000000000000000000000000000000000000000000000002aa8b9a6f21a00000000000000000000000000000000000000000000000000002f423c318bfa11001408b715ce20cf236b69"        }      }    },    {      "status": "refused",      "route": {        "venue": "v4",        "poolId": "0xa1954b08e9ed9a942bb49b8d5e4ead04d20d070947fee03892b9b22a7df88c3d"      },      "feeBps": 5,      "error": {        "code": "FILL_TOO_LARGE",        "message": "This Uniswap V4 pool can take at most 250000 of the input token right now",        "details": {          "maxAmountIn": "250000"        }      }    }  ]}

{  "error": "string",  "code": "string",  "message": "string",  "details": {},  "requestId": "string"}
{  "error": "string",  "code": "string",  "message": "string",  "details": {},  "requestId": "string"}