Retrieve a price: /prices
Get Price Route
GET
https://api.paraswap.io/prices
This endpoint gets the optimal price and price route required to swap from one token to another.
Query Parameters
Name | Type | Description |
---|---|---|
srcToken* | string | Source Token Address. Instead Token Symbol could be used for tokens listed in the |
srcDecimals* | integer | Source Token Decimals. (Can be omitted if Token Symbol is used in |
destToken* | string | Destination Token Address. Instead Token Symbol could be used for tokens listed in the |
amount* | string | srcToken amount (in case of SELL) or destToken amount (in case of BUY). The amount should be in WEI/Raw units (eg. 1WBTC -> 100000000) |
side | string | SELL or BUY.
Default: |
network | string | Network ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Fantom - 250, zkEVM - 1101, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100).
Default: |
otherExchangePrices | boolean | If provided, others object is filled in the response with price quotes from other exchanges (if available for comparison).
Default: |
includeDEXS | string | Comma Separated List of DEXs to include.
All supported DEXs by chain can be found here
eg: |
excludeDEXS | string | Comma Separated List of DEXs to exclude.
All supported DEXs by chain can be found here
eg: |
excludeRFQ | boolean | Exclude all RFQs from pricing
eg: |
includeContractMethods | string | |
excludeContractMethods | string | |
userAddress | string | User's Wallet Address. |
route | string | Dash (-) separated list of tokens (addresses or symbols from |
partner | string | Partner string. |
destDecimals* | integer | Destination Token Decimals. (Can be omitted if Token Symbol is used in |
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 | If the source token is a tax token, you should specify the tax amount in BPS. *For example: for a token with a 5% tax, you should set it to 500 as
**Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't. |
destTokenTransferFee | string | If the destination token is a tax token, you should specify the tax amount in BPS. *For example: for a token with a 5% tax, you should set it to 500 as
**Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't. |
srcTokenDexTransferFee | string | If the source token is a tax token, you should specify the tax amount in BPS. Some tokens only charge tax when swapped in/out DEXs and not on ordinary transfers. *For example: for a token with a 5% tax, you should set it to 500 as
**Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't. |
destTokenDexTransferFee | string | If the destination token is a tax token, you should specify the tax amount in BPS. Some tokens only charge tax when swapped in/out DEXs, not on ordinary transfers. *For example: for a token with a 5% tax, you should set it to 500 as
**Note: not all DEXs and contract methods support trading tax tokens, so we will filter those that don't. |
version | number | To specify the protocol version. Values: 5 or 6.2 Default: 5 |
excludeContractMethodsWithoutFeeModel | boolean | Specify that methods without fee support should be excluded from the price route. Default: |
ignoreBadUsdPrice | boolean | If tokens USD prices are not available, |
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 ParaSwap 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-pairInvalid tokens
- (srcToken and destToken) or (route) params are not passedIf 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 deprecatedexcludeDirectContractMethods param is deprecated, please use excludeContractMethodsWithoutFeeModel for newer versions
Invalid Amount
- amount param is not a valid numberValidation failed: <error>
- params validation failed (message has the exact reason for failure)Price Timeout
- reverts when a query takes more time than expectedNo routes found with enough liquidity
Estimated_loss_greater_than_max_impact
Internal Error while computing the price
- something went wrong during the price route calculationInvalid max USD impact
- maxUSDImpact is not a valid numberError while handling price request
- something went wrong during the price route calculation
Last updated