v1

latestOpenAPI 3.1.02026-07-13172871.5 KB
Smart 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

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 quoteYes
outputTokensOutput tokens and proportions for quoteYes
gasPriceGas 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
userAddrAddress 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
slippageLimitPercentSlippage 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
sourceBlacklistList 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
sourceWhitelistList 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
poolBlacklistList of pool ids that are not to be used for the swap pathNo
pathVizImageReturn a Base64 encoded SVG of path visualization image for display on web frontendsNo
pathVizImageConfigOptional customization parameters for generated path viz imageNo
disableRFQsDisable all exchanges that qualify as RFQs with centralized API dependencies and time-sensitive quotes or potential user address restrictions. Default is true.No
referralCodeCode for registering your usage with Odos and receiving partner specific benefits. Referral Code DocumentationNo
compactUse Odos V2 compact call data for transaction, defaults to trueNo
likeAssetIf input and output tokens are all the same asset type (ex: USD stable coins), only route through like assets for decreased slippage. Defaults to falseNo
simpleIf a less complicated quote and/or a quicker response time is desired, this flag can be set. Defaults to falseNo

inputTokens

ParameterDescriptionRequired
tokenAddressAddress of the token to swap from. This should be a checksummed address.Yes
amountAmount of the token in fixed precision. StringYes

outputTokens

ParameterDescriptionRequired
tokenAddressAddress of the token to swap to. This should be a checksummed address.Yes
proportionPercent of token to output. For a single swap, this is set to 1. Float.Yes

pathVizImageConfig

ParameterDescriptionRequired
linkColorsList of hex codes to generate color spectrum for liquidity sources in path visualizationNo
nodeColorHex code for setting the color of token nodes in path visualizationNo
nodeTextColorHex code to set the color of token symbol text on token nodesNo
legendTextColorHex code to set the color of the visualization legend textNo
widthSet a custom width proportion for the visualizationNo
heightSet a custom height proportion for the visualizationNo

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

ParameterDescription
deprecatedIf 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.
pathIdID of the path used for asking for an assembled quote
blockNumberBlock number the quote was generated for
gasEstimateA very naive gas estimate
gasEstimateValueUSD Value of the gasEstimate
dataGasEstimateUsed for Layer 2 chains
gweiPerGasAmount of gWei per gas unit
inTokensA list of token addresses and amounts
inAmountsA list of input token amounts
outTokensA list of token addresses and amounts
outAmountsA list of output token amounts
netOutValueUSD value of the sum of the output tokens after gas
outValuesA list of the output values of the given output tokens. In the same order as the outputTokens list
priceImpactPercent decrease in the realized price of the path from the initial price of the path before the swap is executed.
percentDiffPercent difference between the value of all input tokens and the value of all output tokens (as determined by the Odos pricing service)
partnerFeePercentPercent fee taken by partner referral code given. Fee is already deducted from quote
pathVizImageBase64 encoded image ready to be used within a UI
post/sor/swap/v3

Request body

deprecatedstring nullable
traceIdstring nullable
chainIdinteger required

Chain ID to request path for

gasPricenumber nullable

Gas Price

userAddrstring nullable

Address of wallet to use to generate transaction

slippageLimitPercentnumber nullable

Slippage to use for checking the path is valid

sourceBlackliststring[] nullable

List of liquidity providers that are not to be used for the swap path.

sourceWhiteliststring[] nullable

List of liquidity providers to exclusively use for the swap path.

poolBlackliststring[] nullable

List of pool addresses to exclude from swap path consideration

pathVizboolean nullable
pathVizImageboolean nullable
disableRFQsboolean nullable

Flag to disable all off-chain RFQs from order routing

referralCodeinteger nullable
referralFeenumber nullable
referralFeeRecipientstring nullable

Address of wallet to receive referral fee

compactboolean nullable
likeAssetboolean nullable
simpleboolean nullable
permit2boolean nullable
simulateboolean nullable
receiverstring nullable

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