---
title: "Generate Odos Quote"
method: POST
path: "/sor/quote/v2"
tags: ["Smart Order Routing"]
---

# Generate Odos Quote

`POST /sor/quote/v2`

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`](#/Info/get_chain_ids_info_chains_get). | 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}`](#/Info/liquidity_sources_info_liquidity_sources__chain_id__get) | 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}`](#/Info/liquidity_sources_info_liquidity_sources__chain_id__get) | 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](https://docs.odos.xyz/product/sor/v2/referral-code) | 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](https://eips.ethereum.org/EIPS/eip-55). | 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](https://eips.ethereum.org/EIPS/eip-55). | 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:

```json
{
  "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 |

## Request body

- PathRequestV2 — Public facing path request v2 schema
  - `deprecated` string, nullable
  - `traceId` string, nullable
  - `chainId` integer, required — Chain ID to request path for
  - `inputTokens` TokenAmount[], required — Input tokens and amounts for quote
    - `tokenAddress` string, required — Token contract address
    - `amount` string, required — Amount of token to swap
  - `outputTokens` TokenProportion[], required — Output tokens and proportions for quote
    - `tokenAddress` string, required — Token contract address
    - `proportion` number — Proportion of token
  - `gasPrice` number, nullable — Gas Price
  - `userAddr` string, nullable — Address of wallet to use to generate transaction
  - `slippageLimitPercent` number, nullable — Slippage to use for checking the path is valid
  - `sourceBlacklist` string[], nullable — List of liquidity providers that are not to be used for the swap path.
  - `sourceWhitelist` string[], nullable — List of liquidity providers to exclusively use for the swap path.
  - `poolBlacklist` string[], nullable — List of pool addresses to exclude from swap path consideration
  - `pathViz` boolean, nullable
  - `pathVizImage` boolean, nullable
  - `pathVizImageConfig` PathVizImageConfig — Schema for path viz image config
    - `linkColors` string[], nullable
    - `nodeColor` string, nullable
    - `nodeTextColor` string, nullable
    - `legendTextColor` string, nullable
    - `width` integer, nullable
    - `height` integer, nullable
  - `disableRFQs` boolean, nullable — Flag to disable all off-chain RFQs from order routing
  - `referralCode` integer, nullable
  - `compact` boolean, nullable
  - `likeAsset` boolean, nullable
  - `simple` boolean, nullable

## Response `200`

Successful Response

- QuoteResponse — Quote response schema
  - `deprecated` string, nullable
  - `traceId` string, nullable
  - `inTokens` string[], required
  - `outTokens` string[], required
  - `inAmounts` string[], required
  - `outAmounts` string[], required
  - `gasEstimate` number, required
  - `dataGasEstimate` integer, required
  - `gweiPerGas` number, required
  - `gasEstimateValue` number, required
  - `inValues` number[], required
  - `outValues` number[], required
  - `netOutValue` number, required
  - `priceImpact` number, nullable
  - `percentDiff` number, required
  - `permit2Message` object, nullable
  - `permit2Hash` string, nullable
  - `partnerFeePercent` number
  - `pathId` string, nullable
  - `pathViz` object, nullable
  - `pathVizImage` string, nullable
  - `blockNumber` integer, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/odos/apis/odos-api.md) · [All operations](https://skmtc.dev/odos/apis/odos-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/odos/odos-api/revisions/326e35e349c9/schema)
