v1
latestOpenAPI 3.1.02026-07-13172871.5 KBSmart Order Routing
Generate Odos Quote V3 + Assembly
Quote a path for swapping between assets atomically. This can be used programmatically to check for a quoted price of a given trade without needing to wait for an assembled transaction to be created and provided. It can also be used to anonymously check quotes.
Request Body
| 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. This price directly affects the path computation. If no gas price is provided, our default price from our frontend will be used. | No |
| userAddr | Address of the wallet executing the swap. If no wallet is provided, the quote cannot be turned into a path. This can be viewed as informational only. | No |
| slippageLimitPercent | Slippage percent to use for checking if the path is valid. Float. Example: to set slippage to 0.5% send 0.5. If 1% is desired, send 1. If not provided, slippage will be set 0.3. | No |
| sourceBlacklist | List of liquidity providers that are not to be used for the swap path. A list of all liquidity providers for a given chain can be retrieved from info/liquidity-sources/{chain_id} | No |
| sourceWhitelist | List of liquidity providers to exclusively use for the swap path. A list of all liquidity providers for a given chain can be retrieved from info/liquidity-sources/{chain_id} | No |
| poolBlacklist | List of pool ids that are not to be used for the swap path | No |
| pathVizImage | Return a Base64 encoded SVG of path visualization image for display on web frontends | No |
| pathVizImageConfig | Optional customization parameters for generated path viz image | No |
| disableRFQs | Disable all exchanges that qualify as RFQs with centralized API dependencies and time-sensitive quotes or potential user address restrictions. Default is true. | No |
| referralCode | Code for registering your usage with Odos and receiving partner specific benefits. Referral Code Documentation | No |
| compact | Use Odos V2 compact call data for transaction, defaults to true | No |
| likeAsset | If input and output tokens are all the same asset type (ex: USD stable coins), only route through like assets for decreased slippage. Defaults to false | No |
| simple | If a less complicated quote and/or a quicker response time is desired, this flag can be set. Defaults to false | No |
inputTokens
| Parameter | Description | Required |
|---|---|---|
| tokenAddress | Address of the token to swap from. This should be a checksummed address. | Yes |
| amount | Amount of the token in fixed precision. String | Yes |
outputTokens
| Parameter | Description | Required |
|---|---|---|
| tokenAddress | Address of the token to swap to. This should be a checksummed address. | Yes |
| proportion | Percent of token to output. For a single swap, this is set to 1. Float. | Yes |
pathVizImageConfig
| Parameter | Description | Required |
|---|---|---|
| linkColors | List of hex codes to generate color spectrum for liquidity sources in path visualization | No |
| nodeColor | Hex code for setting the color of token nodes in path visualization | No |
| nodeTextColor | Hex code to set the color of token symbol text on token nodes | No |
| legendTextColor | Hex code to set the color of the visualization legend text | No |
| width | Set a custom width proportion for the visualization | No |
| height | Set a custom height proportion for the visualization | No |
Example Full Config Response:
{
"linkColors": ["#123456"],
"nodeColor": "#1BEEF1",
"nodeTextColor": "#FFFFFF",
"legendTextColor": "#000000",
"width": 1200,
"height": 800
}
Basic integration:
Set the src attribute of an <img /> HTML tag to the pathVizImage text field of the quote response
Response Body
| Parameter | Description |
|---|---|
| deprecated | If the endpoint or any part of the request is deprecated, this field will be populated with a message. This field is omitted if there is nothing to notify on. |
| pathId | ID of the path used for asking for an assembled quote |
| blockNumber | Block number the quote was generated for |
| gasEstimate | A very naive gas estimate |
| gasEstimateValue | USD Value of the gasEstimate |
| dataGasEstimate | Used for Layer 2 chains |
| gweiPerGas | Amount of gWei per gas unit |
| inTokens | A list of token addresses and amounts |
| inAmounts | A list of input token amounts |
| outTokens | A list of token addresses and amounts |
| outAmounts | A list of output token amounts |
| netOutValue | USD value of the sum of the output tokens after gas |
| outValues | A list of the output values of the given output tokens. In the same order as the outputTokens list |
| priceImpact | Percent decrease in the realized price of the path from the initial price of the path before the swap is executed. |
| percentDiff | Percent difference between the value of all input tokens and the value of all output tokens (as determined by the Odos pricing service) |
| partnerFeePercent | Percent fee taken by partner referral code given. Fee is already deducted from quote |
| pathVizImage | Base64 encoded image ready to be used within a UI |
post/sor/swap/v3
Request body
Example request
{
"chainId": 1,
"compact": true,
"gasPrice": 20,
"inputTokens": [
{
"amount": "189000000",
"tokenAddress": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
}
],
"outputTokens": [
{
"proportion": 1,
"tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}
],
"referralCode": 0,
"slippageLimitPercent": 0.3,
"sourceBlacklist": [],
"sourceWhitelist": [],
"userAddr": "0x47E2D28169738039755586743E2dfCF3bd643f86"
}Response
Successful Response