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)
Request
- Base URLhttps://svc.blockdaemon.com
- URLhttps://svc.blockdaemon.com/defi/v1/dex/price
- AuthAPI key in header X-API-Key
Query parameters
The unique ID to specify the decentralized exchange (DEX) within a particular blockchain. Find more here.
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'.
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".
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.
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.
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.
Response
Successful response
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.