# Retrieve a price: /prices

## Get Price Route

<mark style="color:blue;">`GET`</mark> `https://api.paraswap.io/prices`

This endpoint gets the optimal price and price route required to swap from one token to another.

You’ll find the parameters to build a successful query below:

#### Query Parameters

| Name                                           | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| srcToken<mark style="color:red;">\*</mark>     | string  | Source Token Address. Instead **Token Symbol** could be used for tokens listed in the `/tokens` endpoint.                                                                                                                                                                                                                                                                                                                                       |
| srcDecimals<mark style="color:red;">\*</mark>  | integer | Source Token Decimals. (Can be omitted if Token Symbol is used in `srcToken`).                                                                                                                                                                                                                                                                                                                                                                  |
| destToken<mark style="color:red;">\*</mark>    | string  | Destination Token Address. Instead **Token Symbol** could be used for tokens listed in the  `/tokens` endpoint.                                                                                                                                                                                                                                                                                                                                 |
| amount<mark style="color:red;">\*</mark>       | string  | <p>srcToken amount (in case of SELL) or destToken amount (in case of BUY). <br>The amount should be in <strong>WEI/Raw units</strong> (eg. 1WBTC -> 100000000) </p>                                                                                                                                                                                                                                                                             |
| side                                           | string  | <p><strong>SELL</strong> or <strong>BUY</strong>. <br>Default: <code>SELL</code>.</p>                                                                                                                                                                                                                                                                                                                                                           |
| network                                        | string  | <p>Network ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100, Sonic - 146, Unichain - 130, Plasma - 9745).<br>Default: <code>1</code>.</p>                                                                                                                                                                                                                               |
| otherExchangePrices                            | boolean | <p>If provided, <strong>others</strong> object is filled in the response with price quotes from other exchanges <em>(if available for comparison)</em>.<br>Default: <code>false</code></p>                                                                                                                                                                                                                                                      |
| includeDEXS                                    | string  | <p>Comma Separated List of DEXs to include. <br>All supported DEXs by chain can be found <a href="https://api.paraswap.io/adapters/list/1">here </a><br>eg: <code>UniswapV3, CurveV1</code></p>                                                                                                                                                                                                                                                 |
| excludeDEXS                                    | string  | <p>Comma Separated List of DEXs to exclude.<br>All supported DEXs by chain can be found <a href="https://api.paraswap.io/adapters/list/1">here </a><br>eg: <code>UniswapV3, CurveV1</code></p>                                                                                                                                                                                                                                                  |
| excludeRFQ                                     | boolean | <p>Exclude all RFQs from pricing <br>eg: <code>AugustusRFQ, Hashflow</code><br>Default: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                  |
| includeContractMethods                         | string  | Comma Separated List of Comma Separated List of Contract Methods to include in pricing (without spaces). View the list of the supported methods for [V5 ](https://developers.paraswap.network/api/master/api-v5#supported-methods)and [V6](https://developers.paraswap.network/api/master/api-v6.2#supported-methods) eg: `swapExactAmountIn,swapExactAmountInOnUniswapV2`                                                                      |
| excludeContractMethods                         | string  | Comma Separated List of Contract Methods to exclude from pricing (without spaces). View the list of the supported methods for [V5 ](https://developers.paraswap.network/api/master/api-v5#supported-methods)and [V6](https://developers.paraswap.network/api/master/api-v6.2#supported-methods)                                                                                                                                                 |
| userAddress                                    | string  | User's Wallet Address.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| route                                          | string  | <p>Dash (-) separated list of tokens (addresses or symbols from <code>/tokens</code>) to comprise the price route. <em>Max 4 tokens.</em> <br><em><strong>\*Note:</strong> If <code>route</code> is specified, the response will only comprise of the route specified which might not be the optimal route.</em> </p>                                                                                                                           |
| partner                                        | string  | <p>Partner string.</p><p><br>If no <code>partner</code> is passed, it defaults to anon which charges a flat 1bps fee for all swaps. <code>partner</code> should be different from the existing ones that may charge indepent fees. </p>                                                                                                                                                                                                         |
| destDecimals<mark style="color:red;">\*</mark> | integer | Destination Token Decimals. (Can be omitted if Token Symbol is used in `destToken`).                                                                                                                                                                                                                                                                                                                                                            |
| maxImpact                                      | number  | In %. It's a way to bypass the API price impact check (default = 15%).                                                                                                                                                                                                                                                                                                                                                                          |
| receiver                                       | String  | Receiver's Wallet address. (Can be omitted if swapping tokens from and to same account)                                                                                                                                                                                                                                                                                                                                                         |
| srcTokenTransferFee                            | string  | <p>If the source token is a tax token, you should specify the tax amount in BPS.</p><p><em>\*For example: for a token with a 5% tax, you should set it to 500 as</em><br><em><code>\[(500/10000)\*100=5%]</code></em></p><p><em>\*\*Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't.</em> </p>                                                                                           |
| destTokenTransferFee                           | string  | <p>If the destination token is a tax token, you should specify the tax amount in BPS.</p><p><em>\*For example: for a token with a 5% tax, you should set it to 500 as</em><br><em><code>\[(500/10000)\*100=5%]</code></em></p><p><em>\*\*Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't.</em> </p>                                                                                      |
| srcTokenDexTransferFee                         | string  | <p>If the source token is a tax token, you should specify the tax amount in BPS.<br>Some tokens only charge tax when swapped in/out DEXs and not on ordinary transfers.</p><p><em>\*For example: for a token with a 5% tax, you should set it to 500 as</em><br><em><code>\[(500/10000)\*100=5%]</code></em></p><p><em>\*\*Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't.</em> </p>    |
| destTokenDexTransferFee                        | string  | <p>If the destination token is a tax token, you should specify the tax amount in BPS. <br>Some tokens only charge tax when swapped in/out DEXs, not on ordinary transfers.</p><p><em>\*For example: for a token with a 5% tax, you should set it to 500 as</em><br><em><code>\[(500/10000)\*100=5%]</code></em></p><p><em>\*\*Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't.</em> </p> |
| version                                        | number  | <p>To specify the protocol version. <strong>Values:</strong> 5 or 6.2<br><strong>Default</strong>: 5</p>                                                                                                                                                                                                                                                                                                                                        |
| excludeContractMethodsWithoutFeeModel          | boolean | Specify that methods without fee support should be excluded from the price route. Default: `false`                                                                                                                                                                                                                                                                                                                                              |
| ignoreBadUsdPrice                              | boolean | If tokens USD prices are not available, `Bad USD Price` error will be thrown. Use this param to skip this check. Default: `false`                                                                                                                                                                                                                                                                                                               |

Here are two examples of a successful price response and a failed query.

The first query was a sell price request on Ethereum Mainnet (chainId: 1) using Velora's Market API. The request aimed to swap 1,000 USDC for ETH (destToken: 0xeeee...eeee) while retrieving the best possible route for the trade.

As a result, it successfully retrieved an optimized route for swapping 1,000 USDC to ETH via Uniswap V3, with minimal slippage and efficient execution while estimating gas costs.

{% tabs %}
{% tab title="200 Successful Price Response." %}

```
{
    "priceRoute": {
        "blockNumber": 19462957,
        "network": 1,
        "srcToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "srcDecimals": 6,
        "srcAmount": "1000000000",
        "destToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "destDecimals": 18,
        "destAmount": "283341969876959340",
        "bestRoute": [
            {
                "percent": 100,
                "swaps": [
                    {
                        "srcToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
                        "srcDecimals": 6,
                        "destToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                        "destDecimals": 18,
                        "swapExchanges": [
                            {
                                "exchange": "UniswapV3",
                                "srcAmount": "1000000000",
                                "destAmount": "283341969876959340",
                                "percent": 100,
                                "poolAddresses": [
                                    "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
                                ],
                                "data": {
                                    "path": [
                                        {
                                            "tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
                                            "tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                                            "fee": "500",
                                            "currentFee": "500"
                                        }
                                    ],
                                    "gasUSD": "13.515820"
                                }
                            }
                        ]
                    }
                ]
            }
        ],
        "gasCostUSD": "14.656605",
        "gasCost": "118200",
        "side": "SELL",
        "version": "6.2",
        "contractAddress": "0x6a000f20005980200259b80c5102003040001068",
        "tokenTransferProxy": "0x6a000f20005980200259b80c5102003040001068",
        "contractMethod": "swapExactAmountInOnUniswapV3",
        "partnerFee": 0,
        "srcUSD": "999.4370000000",
        "destUSD": "1003.8267642998",
        "partner": "anon",
        "maxImpactReached": false,
        "hmac": "7975cda2fd343cb90f1a15d1ec11302c467a8d7d"
    }
}
```

{% endtab %}

{% tab title="400 Price Error" %}

```
{
  "error": "Validation failed with error"
  }
```

{% endtab %}
{% endtabs %}

#### Most common error messages

The following is a list of the most common error messages of the `/prices` endpoint. Most are self-explanatory and can be self-solved,  but feel free to contact Velora Support using the chat in the bottom right corner of this page.

* `Invalid route, from token should be the first token of the route`
* `Invalid route, to token should be the last token of the route`
* `Token not found. Please pass srcDecimals & destDecimals query params to trade any tokens` -Check the doc for more details <https://developers.paraswap.network/api/get-rate-for-a-token-pair>
* `Invalid tokens` - (srcToken and destToken) or (route) params are not passed
* `If receiver is defined userAddress should also be defined`
* `It is not allowed to pass both params: "positiveSlippageToUser" and "takeSurplus".` - We advice removing "positiveSlippageToUser", because it is deprecated
* `excludeDirectContractMethods param is deprecated, please use excludeContractMethodsWithoutFeeModel for newer versions`
* `Invalid Amount` - amount param is not a valid number
* `Validation failed: <error>` - params validation failed (message has the exact reason for failure)
* `Price Timeout` - reverts when a query takes more time than expected
* `No routes found with enough liquidity`&#x20;
* `Bad USD price` ![:large\_orange\_circle:](https://a.slack-edge.com/production-standard-emoji-assets/14.0/apple-medium/1f7e0.png) - src or dest tokens don’t have valid usd price&#x20;
* `Estimated_loss_greater_than_max_impact`
* `Internal Error while computing the price` - something went wrong during the price route calculation
* `Invalid max USD impact` - maxUSDImpact is not a valid number
* `Error while handling price request` - something went wrong during the price route calculation

\ <br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.velora.xyz/api/velora-api/velora-market-api/get-rate-for-a-token-pair.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
