Skip to main content

Quote RPC Method

Subscribe to receive a notification from the Jupiter API to get the best priced quote.

Updated on
Sep 20, 2024

Quote RPC Method

Please note that this method is only available for paid subscribers of Metis - Jupiter V6 Swap API.
To establish a WebSocket connection, you need to simply append '/ws' to your endpoint URL. For parameters, you can include them as URL arguments referred to as "params".
Solana Web3.js 2.0 includes the ability to customize RPC methods and transports, allowing you to seamlessly integrate QuickNode Marketplace add-ons into your applications. For more information on how to use QuickNode Marketplace add-ons with Solana Web3.js 2.0, check out these guides: How to Use QuickNode Add-ons using Solana Web3.js 2.0 (Part 1) and How to Use QuickNode Add-ons using Solana Web3.js 2.0 (Part 2)

Parameters

jsonrpc
string
REQUIRED
The version of the JSON-RPC protocol being used
method
string
REQUIRED
The name of the method to be called. Here, it is 'quote'
id
integer
REQUIRED
A unique identifier for the request
params
object
REQUIRED
Parameters for the swap method
inputMint
string
REQUIRED
The input token mint address
outputMint
string
REQUIRED
The output token mint address
amount
integer
REQUIRED
The amount to swap, have to factor in the token decimals
slippageBps
integer
The slippage % in BPS. If the output token amount exceeds the slippage then the swap transaction will fail
swapMode
string
The swap mode. Possible values include: ExactIn, ExactOut. The default value is set to ExactIn. ExactOut is for supporting use cases where you need an exact token amount, like payments
dexes
array
Specify the DEXes you want to include, separated by commas
excludeDexes
array
The DEXes that you want to exclude. Separate them with commas.
restrictIntermediateTokens
boolean
Restrict intermediate tokens to a top token set that has stable liquidity. This will help to ease potential high slippage error rate when swapping with minimal impact on pricing
onlyDirectRoutes
boolean
Direct Routes limits Jupiter routing to single hop routes only. By default, it is set to false
asLegacyTransaction
boolean
Instead of using versioned transaction, this will use the legacy transaction. By default, it is set to false
platformFeeBps
integer
If you want to charge the user a fee, you can specify the fee in BPS. Fee % is taken out of the output token
maxAccounts
integer
Rough estimate of the max accounts to be used for the quote, so that you can compose with your own accounts
autoSlippage
boolean
Default is false. By setting this to true, the API will automatically suggest slippage. computedAutoSlippage is the computed result, and slippageBps is what we suggest you to use. Reference maxAutoSlippageBps and autoSlippageCollisionUsdValue when using this parameter.
maxAutoSlippageBps
integer
Used in conjunction with autoSlippage when set to true, the maximum slippageBps returned by the API will respect this value. It is recommended that set this value when using autoSlippage.
autoSlippageCollisionUsdValue
integer
Used in conjunction with autoSlippage when set to true, the API will use a default 1000 USD value as way to calculate the slippage impact for the autoSlippage. You can set a custom USD value using this parameter.
useQNMarketCache
boolean
When set to true, the response includes your added pools/markets

Returns

jsonrpc
string
The version of the JSON-RPC protocol being used
id
integer
A unique identifier for the request
result
object
The result of the quote
inputMint
string
The source token's mint address
inAmount
string
The amount of the source token being swapped
outputMint
string
The destination token's mint address
outAmount
string
The amount of the destination token received after the swap
otherAmountThreshold
string
A threshold amount for the destination token
swapMode
string
Indicates the swap mode
slippageBps
integer
Slippage tolerance in basis points
platformFee
object
The platform Fee object which contains the following fields:
amount
string
The amount of the platform fee
feeBps
integer
The fee percentage in basis points
priceImpactPct
string
The percentage of price impact due to the swap
routePlan
array
An array containing detailed information about each step of the swap process
swapInfo
object
Detailed information about a specific swap step
ammKey
string
The key identifying the Automated Market Maker (AMM) responsible for the swap
label
string
A label or identifier for the AMM
inputMint
string
The mint address of the token being swapped from in this step
outputMint
string
The mint address of the token being received in this step
inAmount
string
The amount of the token being swapped from in this step
outAmount
string
The amount of the token being received after the swap in this step
feeAmount
string
The amount of fee charged for this step of the swap
feeMint
string
The mint address of the token used for paying fees in this step
percent
integer
The percentage allocation of the swap for this step
contextSlot
integer
A contextual identifier
timeTaken
integer
Time taken for the request to be processed
Request
1
wscat -c ws \
2
# wait for connection
3
{"jsonrpc": "2.0", "method": "quote", "params": {"inputMint": "So11111111111111111111111111111111111111112", "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount": 1000000, "slippageBps": 1}, "id": 1}
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free