v1

latestOpenAPI 3.1.02026-07-24223580832.9 KB
dex

Aggregate DEX Swap

Aggregates swap quotes from all DEXs supporting a specified token pair. It allows users to customize their query to prioritize either the best output or the lowest gas costs. The response provides detailed transaction data including DEX identifiers, output amounts, swap routing parameters (such as call data), gas estimates, and a reference, enabling traders to compare and select the most efficient swap route for their needs.

💡 Compute Unit Value: 115 (Fixed)

post/defi/v1/dex/swaps

Request body

chainId'1' | '43114' | '56' | '137' | '42161' | '10' | '8453' | '324' | '5000' | '900' | '1400' | '1200' | '101' | '1700' | '1500' | '1100' | '1600' | '8217'

The unique ID to direct queries or transactions to the correct blockchain. Find more here.

pathstring[] required

Comma-separated values of token pair.

amountInstring required

Amount of token.

chainSymbolstring

The abbreviated chain name for queries or transactions.

fromstring required

Address of the sender of the token.

gasstring

Maximum gas to be approved for the transaction.

tostring required

Address of the recipient of the token.

poolFeesstring

Different pool based on the fees. By default, it will take the pool with maximum amountOut.

excludedDexesstring

Comma-separated values of dexes to exclude.

bestNetPriceboolean

If true, sorts prepared transactions by net value (amountsOut minus gas) in descending order. If multiple sort parameters are true, bestNetPrice takes precedence.

bestQuoteboolean

If true, sorts prepared transactions by amountsOut in descending order. If multiple sort parameters are true, bestNetPrice takes precedence.

lowestGasboolean

If true, sorts prepared transactions by gas cost in ascending order. If multiple sort parameters are true, bestNetPrice takes precedence.

gasPrioritystring

Specifies the priority level for gas fees (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.

amountOutMinstring

Minimum amount to be received.

slippagestring

Percentage of total swap value allowed for slippage. Default is 1 (0 <= slippage <= 100).

enableFeeboolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

batchOption'EIP-5792' | 'EIP-7702'

The batch option to be used for the transaction.

batcherContractstring

The EOA address of the batcher that will be used to execute the transaction when using EIP-7702 batching. If not provided, the default batcher contract for the chain will be used.

Example request

{
  "chainId": "1",
  "path": [
    "0x514910771AF9Ca656af840dff83E8264EcF986CA",
    "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
  ],
  "amountIn": "10000",
  "chainSymbol": "ETH",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "gas": "100000",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "poolFees": "3000",
  "excludedDexes": "1700",
  "bestNetPrice": false,
  "bestQuote": false,
  "lowestGas": false,
  "gasPriority": "low",
  "amountOutMin": "0",
  "slippage": "10",
  "enableFee": false,
  "batchOption": "EIP-5792",
  "batcherContract": "0x9c933f9d2efd76ce25b0d3dde84d3f94e78a50ca"
}

Response

Successful response

statusnumber

Numeric status code indicating success or failure of the API call

msgstring

Human-readable message describing the API result or error

Example response

{
  "status": 200,
  "msg": "success",
  "data": [
    {
      "dexName": "UniswapV2",
      "amountsOut": "3696603530",
      "chainId": "1",
      "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
      "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
      "value": "1000000",
      "gas": "800000",
      "data": "0x7ff36ab500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b40200000000000000000000000000000000000000000000000000000193817718420000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f",
      "estimationCheck": "Returned error: insufficient funds for gas * price + value: address 0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402 have 17695120464000 want 136837418655888595",
      "referenceId": "01dac9c06f08417e826b42e28a403d50"
    },
    {
      "dexName": "SushiswapV2",
      "amountsOut": "3693198033",
      "chainId": "1",
      "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
      "to": "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",
      "value": "1000000",
      "gas": "800000",
      "data": "0x7ff36ab500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b40200000000000000000000000000000000000000000000000000000193817718420000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f",
      "estimationCheck": "Returned error: insufficient funds for gas * price + value: address 0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402 have 17695120464000 want 136837418655888595",
      "referenceId": "01dac9c06f08417e826b42e28a403d50"
    },
    {
      "dexName": "UniswapV3",
      "amountsOut": "3696374718",
      "chainId": "1",
      "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
      "to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
      "value": "1000000",
      "gas": "800000",
      "data": "0xac9650d8000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000e404e45aaf000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b40200000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412210e8a00000000000000000000000000000000000000000000000000000000",
      "estimationCheck": "Returned error: insufficient funds for gas * price + value: address 0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402 have 17695120464000 want 136837418655888595",
      "referenceId": "01dac9c06f08417e826b42e28a403d50"
    },
    {
      "dexName": "0x",
      "amountsOut": "3695949530",
      "chainId": "1",
      "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
      "to": "0x70bf6634ee8cb27d04478f184b9b8bb13e5f4710",
      "value": "1000000",
      "gas": "800000",
      "data": "0x1fff991f000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b4020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000da29e44400000000000000000000000000000000000000000000000000000000000000a049f45b98764cc9c837ea3898a1a07800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000010438c9c147000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000002710000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000024d0e30db00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4d92aadfb00000000000000000000000070bf6634ee8cb27d04478f184b9b8bb13e5f47100000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000dcb2edbfd08400449e9d945c57f1a4d289fba1d97785d27b93b45020f6886192880ae61300000000000000000000000000000000000000000000000000000000674c263b000000000000000000000000b02f39e382c90160eb816de5e0e428ac771d77b50000000000000000000000000000000000000000000000000000000000000120000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000411b64c63d6976390e6613f9da98022a6e01a9d4f499060dacefb87225e98132c1c6778cd65649acc761390e0d6a32870eef601a9fcf751b7e65b4af84ea90c3f7270000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012438c9c1470000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000ad01c20d5886137e056775af56915de824c8fce500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "estimationCheck": "Returned error: insufficient funds for gas * price + value: address 0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402 have 17695120464000 want 136837418655888595",
      "referenceId": "01dac9c06f08417e826b42e28a403d50"
    },
    {
      "dexName": "Kyberswap",
      "amountsOut": "3696603530",
      "chainId": "1",
      "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
      "to": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",
      "value": "1000000",
      "gas": "800000",
      "data": "0xe21fd0e90000000000000000000000000000000000000000000000000000000000000020000000000000000000000000f081470f5c6fbccf48cc4e5b82dd926409dcdd67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b40200000000000000000000000000000000000000000000000000000000674c2aaa0000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000040989238340000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000aaaaaaaaa24eeeb8d57d431224f73832bc34f68800000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae900000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400e00deaa0000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000800000000000000000000000007a7d6209d5950bb3b5b3a7724eeb48df8e8a1a630000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae90000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000017ca44e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000003a8e0000000000000000000000037d82cb19000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b40200000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002137b22536f75726365223a22657870616e64222c22416d6f756e74496e555344223a22302e30303030303030303337303935333233323336383531222c22416d6f756e744f7574555344223a2230222c22526566657272616c223a22222c22466c616773223a302c22416d6f756e744f7574223a2230222c2254696d657374616d70223a313733333034333730362c22496e74656772697479496e666f223a7b224b65794944223a2231222c225369676e6174757265223a2243756e47794b4155314c357567746a53554563565a68674d38505a41534b634d444b5732346a367635337a425a585852497570492b4d7432685165704e7574704e4965716a532f6e716d4a384c2b697979373278497556563671582f71354550534b79324a7a716f4630765a444d3551484664473332302b5571784b4c5132734e79686e62756f4d685a76715a4c7932546e6f315474584238325771456739417a57516b33463875434d57776c716b717a75463869366a4a6a34666d62427455354c6a5533694d592f7077527a477a68523738736368414e59697569544a316d64753177413158373676334839427a52726c4e4131666747316a67474459314b596857785576386e376e3437632f6e6d3064532b5042466773394338336675377956765368696f5445574e52694b6a64613039334e577846305741436d396246784b7062564f377145304e55335968306432366372773d3d227d7d00000000000000000000000000",
      "estimationCheck": "Returned error: insufficient funds for gas * price + value: address 0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402 have 17695120464000 want 136837418655888595",
      "referenceId": "01dac9c06f08417e826b42e28a403d50"
    }
  ]
}