v1

latestOpenAPI 3.0.02026-07-136017.3 KB
swap

generates a quote

By passing in the appropriate options, you can generate a swap quote

get/quote/v7/{chainId}

Path parameters

chainIdnumber required

chainId

Query parameters

referrerstring

referrer

tokenInstring required

input token address

tokenOutstring required

output token address

amountinteger required

input token amount

feenumber

amount of the fee, for example 0.0025 (0.25%)

feeBy'input' | 'output'

if fee > 0 then which token to take fee from input or output

maxPriceImpactnumber

the max price impact for route planning. It's better to set it to a reasonable value, for example 1 (100%)

maxSlippagenumber

the max slippage for route execution, for example 0.005 (0.5%)

onlyDEXstring

a list of DEX names separated by comma. If exists in the request then only pools from these DEXes are used in the response route. List of all supported DEXes can be obtained with /liquidity-provider request

onlyPoolsstring

a list of pools addresses separated by comma. If exists in the request then only these pools are used in the response route

excludeDEXstring

a list of DEX names separated by comma. If exists in the request then pools from these DEXes are excluded in the response route. List of all supported DEXes can be obtained with /liquidity-provider request

excludePoolsstring

a list of pools addresses separated by comma. If exists in the request then these pools are excluded in the response route

excludeTokensstring

a list of token addresses separated by comma. If exists in the request then pools with these tokens are excluded in the response route

visualizeboolean

vizulaization

Response

quote

object required

Example response

{
  "status": "Success",
  "tokens": [
    {
      "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
      "symbol": "ETH",
      "name": "Ether",
      "decimals": 18
    },
    {
      "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
      "symbol": "WETH",
      "name": "Wrapped Ether",
      "decimals": 18
    },
    {
      "address": "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2",
      "symbol": "SUSHI",
      "name": "SushiToken",
      "decimals": 18
    }
  ],
  "tokenFrom": 0,
  "tokenTo": 2,
  "swapPrice": 2837.6709246572527,
  "priceImpact": -0.002204113661183449,
  "amountIn": "10000000000000000",
  "assumedAmountOut": "28376709246572527616"
}
All 6 operations