Build a swap transaction
Quotes the route you picked again and returns the transaction for the trader's wallet, with any token approvals first, on Uniswap V4, 1inch Aqua, Orca and Raydium. It takes an API key issued to your integration, and the shared and docs keys are refused.
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
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
application/json
application/json
curl -X POST "https://example.com/api/swap/prepare" \ -H "Content-Type: application/json" \ -d '{ "chainId": 8453, "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "tokenOut": "0x4200000000000000000000000000000000000006", "tradeType": "exactIn", "amountIn": "1000000", "slippageBps": 50, "maxPriceImpactBps": 500, "route": { "venue": "v4", "poolId": "0x5622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e8639" }, "minAmountOut": "396888850224313", "recipient": "0x4444444444444444444444444444444444444444", "requestId": "order-1042" }'{ "venue": "v4", "chainId": 8453, "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "tokenOut": "0x4200000000000000000000000000000000000006", "tradeType": "exactIn", "recipient": "0x4444444444444444444444444444444444444444", "amountIn": "1000000", "amountOut": "398883266557098", "minAmountOut": "396888850224313", "maxAmountIn": "1000000", "priceImpact": { "lossBps": 31, "warnBps": 500, "refuseBps": 1500 }, "impactTier": "normal", "route": { "venue": "v4", "poolId": "0x5622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e8639" }, "approvals": [ { "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "data": "0x095ea7b3000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba300000000000000000000000000000000000000000000000000000000000f4240", "value": "0", "description": "Let Permit2 move up to 1000000 of tokenIn" }, { "to": "0x000000000022D473030F116dDEE9F6B43aC78BA3", "data": "0x87517c45000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000006ff5693b99212da76ad316178a184ab56d299b4300000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000006aceb119", "value": "0", "description": "Let the Universal Router spend up to 1000000 of tokenIn through Permit2" } ], "transaction": { "to": "0x6fF5693b99212Da76ad316178A184AB56D299b43", "data": "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006aceaa4d00000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003060c0e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000000000005e0000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000200000000000000000000000004200000000000000000000000000000000000006000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000005aef2c787afc743d20fd632d66391b2ccd5c68c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000168f7e2eed4b9000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000003a002dfe74a2cb04a2c6a71d638e9f410dd0f3b846e3cf9c99f3239274c7fb4345b000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000020a06fbf084c33e181b1b8de07db6dc50f532716a1e8ed377b77c0f77b309a918e5622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e86395622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e86390000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0bdc0000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d250000000000000000000000000000000000000000000346c5f3090f523fa75662000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000006aceaa4d0000000000000000000000006ff5693b99212da76ad316178a184ab56d299b43000000000000000000000000444444444444444444444444444444444444444400000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000041fdcfefcac14c902f22d4bdd91a6f008c46604d3a62e3a8cb9ff441cdda630d171b69a0a113d67d234a56d6041e4a2c0a5d256daaadd516e26e8f7a762f9f07aa1b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000011111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf61cfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcfe14000000000000000000000000000000000000000000000000000000fe9558d1e100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000420000000000000000000000000000000000000600000000000000000000000044444444444444444444444444444444444444440000000000000000000000000000000000000000000000000000000000000000", "value": "0", "description": "Swap on Uniswap V4" }, "deadline": "1791928909", "v4": { "authorization": { "swapId": "0xa06fbf084c33e181b1b8de07db6dc50f532716a1e8ed377b77c0f77b309a918e", "poolId": "0x5622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e8639", "classId": "38960560214548620419581884607967218229413556116830054641371650059665611327033", "nonce": "42", "deadline": "1791928909", "executor": "0x6fF5693b99212Da76ad316178A184AB56D299b43", "sqrtPriceStartX96": "3960994633772755407296098", "signature": "0xfdcfefcac14c902f22d4bdd91a6f008c46604d3a62e3a8cb9ff441cdda630d171b69a0a113d67d234a56d6041e4a2c0a5d256daaadd516e26e8f7a762f9f07aa1b", "ranges": [ { "lp": "0x1111111111111111111111111111111111111111", "position": 0, "tickLower": -199140, "tickUpper": -197100, "liquidity": "1093427319265" } ] }, "hookData": "0x02dfe74a2cb04a2c6a71d638e9f410dd0f3b846e3cf9c99f3239274c7fb4345b000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000020a06fbf084c33e181b1b8de07db6dc50f532716a1e8ed377b77c0f77b309a918e5622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e86395622e547d200169623684248c4e4ac258688aea6dd540acf5fb26965861e86390000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0bdc0000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d250000000000000000000000000000000000000000000346c5f3090f523fa75662000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000006aceaa4d0000000000000000000000006ff5693b99212da76ad316178a184ab56d299b43000000000000000000000000444444444444444444444444444444444444444400000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000041fdcfefcac14c902f22d4bdd91a6f008c46604d3a62e3a8cb9ff441cdda630d171b69a0a113d67d234a56d6041e4a2c0a5d256daaadd516e26e8f7a762f9f07aa1b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000011111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf61cfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcfe14000000000000000000000000000000000000000000000000000000fe9558d1e10000000000000000000000000000000000000000000000000000000000000000" }}{ "error": "string", "code": "string", "message": "string", "details": {}, "requestId": "string"}{ "error": "string", "code": "string", "message": "string", "details": {}, "requestId": "string"}{ "error": "string", "code": "string", "message": "string", "details": {}, "requestId": "string"}{ "error": "string", "code": "string", "message": "string", "details": {}, "requestId": "string"}List a wallet's swaps
Returns the wallet's settled swaps on Uniswap V4, 1inch Aqua, Orca and Raydium, newest first on every chain, with what it paid and received. Send `venue` or `chainId` to narrow it.
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`.