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
| Parameter | Description | Required |
|---|---|---|
chainId | Chain ID to use for quote generation. A list of valid chains can be retrieved from info/chains. | Yes |
inputTokens | Input tokens and amounts for quote. | Yes |
outputTokens | Output tokens and proportions for quote. | Yes |
gasPrice | Gas price to use for path generation. If not provided, Odos defaults will be used. | No |
userAddr | Address of the wallet executing the swap. Required to assemble the quote. | No |
slippageLimitPercent | Slippage percent for path validity. Float. Example: 0.5 = 0.5%. Default = 0.3. | No |
sourceBlacklist | List of liquidity providers to exclude. Get all via info/liquidity-sources/{chain_id}. | No |
sourceWhitelist | List of liquidity providers to exclusively use. | No |
poolBlacklist | List of pool addresses to exclude. | No |
pathVizImage | Return Base64 encoded SVG of path visualization for UI. | No |
pathVizImageConfig | Customize generated path visualization. | No |
compact | Use Odos v3 compact calldata (default: true). | No |
likeAsset | Restrict routing to like-assets (e.g., USD stablecoins). Default false. | No |
simple | Simplified route for quicker response. Default false. | No |
inputTokens
| Parameter | Description | Required |
|---|---|---|
tokenAddress | Token address (checksummed). | Yes |
amount | Token amount (string, fixed precision). | Yes |
outputTokens
| Parameter | Description | Required |
|---|---|---|
tokenAddress | Token address (checksummed). | Yes |
proportion | Output proportion (1 for single token). | Yes |
Example: Generate a Quote
This example swaps 10 USDC for ODOS on the Base network.
- JavaScript
- Python
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);
import requests
import os
from dotenv import load_dotenv
load_dotenv()
quote_url = 'https://enterprise-api.odos.xyz/sor/quote/v3'
quote_request_body = {
"chainId": 8453,
"inputTokens": [
{"tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amount": "10000000"}
],
"outputTokens": [
{"tokenAddress": "0xca73ed1815e5915489570014e024b7EbE65dE679", "proportion": 1}
],
"userAddr": "0x...",
"slippageLimitPercent": 0.3,
"compact": True
}
headers = {
"Content-Type": "application/json",
"x-api-key": os.getenv("ODOS_API_KEY")
}
response = requests.post(quote_url, json=quote_request_body, headers=headers)
quote = response.json()
print(quote)
Response Body
| Parameter | Description |
|---|---|
deprecated | Deprecation message if applicable. |
pathId | Path ID for assembling transaction. |
blockNumber | Block number used for quote. |
gasEstimate | Estimated gas. |
gasEstimateValue | USD gas value. |
dataGasEstimate | Gas used for L2 chains. |
gweiPerGas | Gas price in gwei. |
inTokens | Input token addresses and amounts. |
inAmounts | Input amounts. |
outTokens | Output token addresses and amounts. |
outAmounts | Output amounts. |
netOutValue | Net USD value after gas. |
outValues | USD values of outputs. |
priceImpact | Percent difference from ideal price. |
percentDiff | Difference between input and output USD values. |
partnerFeePercent | Partner referral fee percent, if applicable. |
pathVizImage | Base64-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.