Skip to main content

Quote

The /sor/quote/v3 endpoint returns an optimized onchain route for a token swap. It calculates the most efficient multi-path trade by analyzing liquidity across DEXs, pools, and intermediary tokens, while factoring in gas cost and slippage.


Request Body Parameters

ParameterDescriptionRequired
chainIdChain ID to use for quote generation. A list of valid chains can be retrieved from info/chains.Yes
inputTokensInput tokens and amounts for quote.Yes
outputTokensOutput tokens and proportions for quote.Yes
gasPriceGas price to use for path generation. If not provided, Odos defaults will be used.No
userAddrAddress of the wallet executing the swap. Required to assemble the quote.No
slippageLimitPercentSlippage percent for path validity. Float. Example: 0.5 = 0.5%. Default = 0.3.No
sourceBlacklistList of liquidity providers to exclude. Get all via info/liquidity-sources/{chain_id}.No
sourceWhitelistList of liquidity providers to exclusively use.No
poolBlacklistList of pool addresses to exclude.No
pathVizImageReturn Base64 encoded SVG of path visualization for UI.No
pathVizImageConfigCustomize generated path visualization.No
compactUse Odos v3 compact calldata (default: true).No
likeAssetRestrict routing to like-assets (e.g., USD stablecoins). Default false.No
simpleSimplified route for quicker response. Default false.No

inputTokens

ParameterDescriptionRequired
tokenAddressToken address (checksummed).Yes
amountToken amount (string, fixed precision).Yes

outputTokens

ParameterDescriptionRequired
tokenAddressToken address (checksummed).Yes
proportionOutput proportion (1 for single token).Yes

Example: Generate a Quote

This example swaps 10 USDC for ODOS on the Base network.

import 'dotenv/config';
import fetch from 'node-fetch';

const quoteUrl = 'https://enterprise-api.odos.xyz/sor/quote/v3';

const quoteRequestBody = {
chainId: 8453,
inputTokens: [
{
tokenAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
amount: '10000000'
}
],
outputTokens: [
{
tokenAddress: '0xca73ed1815e5915489570014e024b7EbE65dE679',
proportion: 1
}
],
userAddr: '0x...',
slippageLimitPercent: 0.3,
compact: true
};

const response = await fetch(quoteUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.ODOS_API_KEY
},
body: JSON.stringify(quoteRequestBody)
});

const quote = await response.json();
console.log(quote);

Response Body

ParameterDescription
deprecatedDeprecation message if applicable.
pathIdPath ID for assembling transaction.
blockNumberBlock number used for quote.
gasEstimateEstimated gas.
gasEstimateValueUSD gas value.
dataGasEstimateGas used for L2 chains.
gweiPerGasGas price in gwei.
inTokensInput token addresses and amounts.
inAmountsInput amounts.
outTokensOutput token addresses and amounts.
outAmountsOutput amounts.
netOutValueNet USD value after gas.
outValuesUSD values of outputs.
priceImpactPercent difference from ideal price.
percentDiffDifference between input and output USD values.
partnerFeePercentPartner referral fee percent, if applicable.
pathVizImageBase64-encoded path visualization.

Example Response

{
"pathId": "f2c16f4a3e94a12b9f1cce13e332cc4c",
"outAmounts": ["2389819"],
"gasEstimate": 231122,
"priceImpact": 0.023,
"percentDiff": -0.15,
"traceId": "13b8c84d-4d21-4d2b-8579-71b1f8c0c0c7"
}

The pathId will be used to assemble the transaction and return the call data to be executed onchain.