dex

Get DEX Swap Price

Retrieves a swap quotation for a given token pair or a series of tokens along a specified path. By providing an input amount (amountIn), the endpoint calculates and returns the estimated output amounts for each token in the swap path. This allows users to accurately gauge current market pricing and estimate the value of potential swaps on a decentralized exchange, facilitating more informed trading decisions.

💡 Compute Unit Value: 70 (Fixed)

get/defi/v1/dex/price

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/dex/price
  • Auth
    API key in header X-API-Key

Query parameters

dexId'1000' | '1001' | '1300' | '1301' | '1305' | '1306' | '1307' | '1308' | '1309' | '1310' | '1100' | '1101' | '1200' | '1201' | '2900' | '2901' | '2800' | '2808' | '2809' | '1500' | '1400' | '1402' | '2300' | '2100' | '2101' | '2500' | '2501' | '2700' | '2600' | '2400' | '2401' | '1600' | '1602' | '1604' | '1605' | '1607' | '1608' | '1700' | '1701' | '1702' | '1703' | '1704' | '1706' | '1707' | '2200' | '2201' | '2202' | '2203' | '2204' | '2205' | '2206' | '3000' | '3001' | '3100' | '3300' | '3301' | '3500' | '3501' | '3400' | '3401' | '3600' | '3800' | '3700'

The unique ID to specify the decentralized exchange (DEX) within a particular blockchain. Find more here.

Example:1000
pathstring required

Ordered sequence of token contract addresses defining the swap route, provided as a comma-separated string. For a direct swap from token A to B: 'tokenInAddress,tokenOutAddress'. Example (WETH→USDC on Ethereum): '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'.

Example:0x514910771AF9Ca656af840dff83E8264EcF986CA,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
amountInstring required

Amount of the input token to provide, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: to swap 1 WETH (18 decimals), use "1000000000000000000"; to swap 1 USDC (6 decimals), use "1000000".

Example:1000000000000000000
vsCurrenciesstring

A comma-separated list of currency symbols to convert the amount into, such as 'USD,EUR'. This parameter is optional and allows retrieving values in multiple fiat currencies.

Example:usd,eur,gbp
poolFeesstring

Fee tier of the target liquidity pool in basis points (1 bp = 0.01%). Common values for Uniswap V3-style AMMs: 100 (0.01%), 500 (0.05%), 3000 (0.3%), 10000 (1%). If omitted, the pool yielding the highest output amount is selected automatically.

Example:3000
slippagestring

Maximum acceptable slippage as a percentage of the swap value. Valid range: 0 to 100 (e.g., 1 = up to 1% slippage). Defaults to 1. The transaction reverts if the output deviates more than this percentage from the quoted price.

Example:10

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": {
    "amountIn": "100000000000000000",
    "path": [
      "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
      "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
    ],
    "amountsOut": [
      "100000000000000000",
      "212386733"
    ],
    "prices": {
      "usd": [
        {
          "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": "2125.29"
        },
        {
          "0xaf88d065e77c8cC2239327C5EDb3A432268e5831": "0.999664134155166"
        }
      ]
    },
    "priceImpact": {
      "percentage": "0.0214",
      "value": "0.045422"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.