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
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