Skip to main content

/swap-instructions REST API Endpoint - Swap API

Returns instructions that you can use from the quote you get from /quote.

Updated on
Oct 14, 2026
Please note that this method is only available for paid subscribers of Swap API.
Solana Kit includes the ability to customize RPC methods and transports, allowing you to seamlessly integrate Quicknode add-ons into your applications. For more information on how to use Quicknode add-ons with Solana Kit, check out these guides: How to Use Quicknode Add-ons using Solana Kit (Part 1) and How to Use Quicknode Add-ons using Solana Kit (Part 2)

GooseFX Gamma API: When using the /quote endpoint with the setting of dexes=Gamma, you should include the query parameter dexes=Gamma when using this endpoint if you want to route directly to the GooseFX Gamma API. This is in addition to setting dexes=Gamma on your initial /quote request.

Query Parameters

userPublicKey
string
REQUIRED

The user public key

payer
string

Optional custom payer address that will be used to pay transaction fees and rent for token accounts. Useful if you wish to sponsor users' costs. Be aware that users can close their ATAs externally, so your fee logic should accommodate potential re-creation.

wrapAndUnwrapSol
boolean

If set to true, it will automatically wrap/unwrap SOL. If it is false, it will use wSOL token account. It will be ignored if destinationTokenAccount is set because the destinationTokenAccount may belong to a different user that we have no authority to close. By default, it is set to true

useSharedAccounts
boolean

This enables the usage of shared program accountns. That means no intermediate token accounts or open orders accounts need to be created for the users. But it also means that the likelihood of hot accounts is higher. By default, it is set to true

feeAccount
string

The fee token account is derived using the seeds ['referral_ata', referral_account, mint], along with the REFER4ZgmyYx9c6He5XfaTMiGfdLwRnkV4RPp9t9iF3 referral contract. Only pass in if you set a feeBps and make sure that the feeAccount has been created

trackingAccount
string

Optional public key used to tag and track swap transactions. Enables analytics and indexing via block explorers or analytics platforms like Solscan, SolanaFM, Dune, or Flipside.

computeUnitPriceMicroLamports
integer

The compute unit price to prioritize the transaction, the additional fee will be computeUnitLimit (1400000) * computeUnitPriceMicroLamports. If auto is used, Jupiter will automatically set a priority fee and it will be capped at 5,000,000 lamports / 0.005 SOL

prioritizationFeeLamports
object

To specify a level or amount of additional fees to prioritize the transaction. It can be used for either the priority fee or the JITO tip.

priorityLevelWithMaxLamports
object

Specifies the priority level and maximum lamports for transaction prioritization

priorityLevel
string

The priority level to use for transaction prioritization. Can be set to either medium, high or veryHigh

maxLamports
integer

The maximum amount of lamports to cap the priority fee estimation to prevent overpaying

global
boolean

When set to true, the priority fee estimation will use a global estimate across the network rather than a localized estimate based on the specific accounts involved in the transaction

jitoTipLamports
integer

The exact amount of tip to use in a tip instruction for JITO. You can estimate how much to set using Jito tip percentiles endpoint. It should be used together with the Lil' JIT - Jito Bundles & Transactions add-on or Jito RPC.

jitoTipLamportsWithPayer
object

Specifies the Jito tip amount and a custom payer account to pay for the tip

lamports
integer
REQUIRED

Exact amount of lamports to use for the tip

payer
string
REQUIRED

Public key of an account that will be used to pay for the tip

asLegacyTransaction
boolean

Request a legacy transaction rather than the default versioned transaction, needs to be paired with a quote using asLegacyTransaction otherwise the transaction might be too large. By default, it is set as false

destinationTokenAccount
string

Public key of the token account that will be used to receive the token out of the swap. If not provided, the user's ATA will be used. If provided, we assume that the token account is already initialized

nativeDestinationAccount
string

Public key of an account that will be used to receive native SOL out of the swap. This only works when the output mint is SOL. The account must not be owned by the token program. If not provided, the wrapped SOL will be unwrapped and the native SOL will be sent to the swap authority account. When sending native SOL to a new account, you must swap at least enough to cover the rent required to create it. This parameter is mutually exclusive with destinationTokenAccount

dynamicComputeUnitLimit
boolean

When enabled, it will do a swap simulation to get the compute unit used and set it in ComputeBudget's compute unit limit. This will increase latency slightly since there will be one extra RPC call to simulate this. By default it is set to 'False'

skipUserAccountsRpcCalls
boolean

When enabled, it will not do any rpc calls check on user's accounts. Enable it only when you already setup all the accounts needed for the trasaction, like wrapping or unwrapping sol, destination account is already created.

dynamicSlippage
boolean

When enabled, the swap transaction will estimate slippage in real time and automatically override the slippageBps value from the quote response. This must be used together with dynamicSlippage in the /quote endpoint to ensure consistency. If not used in both places, the transaction will fall back to the original slippageBps from the /quote response. Default is false.

blockhashSlotsToExpiry
integer

Number of slots the transaction remains valid after being built

quoteResponse
object
REQUIRED

The quoteResponse object which you can get from the response from the /quote method

inputMint
string
REQUIRED

The source token's mint address

inAmount
string
REQUIRED

The amount of the source token being swapped

outputMint
string
REQUIRED

The destination token's mint address

outAmount
string
REQUIRED

Calculated output amount from the routing engine. Value includes platform fees and DEX fees, excluding slippage

otherAmountThreshold
string
REQUIRED

Calculated minimum output amount after accounting for slippageBps on the outAmount value

swapMode
string
REQUIRED

Indicates the swap mode

slippageBps
integer
REQUIRED

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
REQUIRED

The percentage of price impact due to the swap

routePlan
array
REQUIRED

An array containing detailed information about each step of the swap process

swapInfo
object
REQUIRED

Detailed information about a specific swap step

ammKey
string
REQUIRED

The key identifying the Automated Market Maker (AMM) responsible for the swap

label
string

A label or identifier for the AMM

inputMint
string
REQUIRED

The mint address of the token being swapped from in this step

outputMint
string
REQUIRED

The mint address of the token being received in this step

inAmount
string
REQUIRED

The amount of the token being swapped from in this step

outAmount
string
REQUIRED

The amount of the token being received after the swap in this step

feeAmount
string
REQUIRED

The amount of fee charged for this step of the swap

feeMint
string
REQUIRED

The mint address of the token used for paying fees in this step

percent
integer
REQUIRED

The percentage allocation of the swap for this step

bps
integer

The basis points allocation of the swap for this step

instructionVersion
string

The version of instruction used in the swap program. Possible values: V1 or V2, or null

contextSlot
integer

A contextual identifier

timeTaken
integer

Time taken for the request to be processed

Returns

tokenLedgerInstruction
object

(Optional) The tokenLedgerInstruction object which contains the following fields:

programId
string

The program ID of the token ledger program

accounts
array

List of accounts involved in the instruction

pubkey
string

The public key of the account

isSigner
boolean

A boolean indicating if the account is a signer

isWritable
boolean

A boolean indicating if the account is writable

data
string

Instruction data in base64 encoding

computeBudgetInstructions
array

The computeBudgetInstructions object which contains the following fields:

programId
string

The program ID of the compute budget program

accounts
array

List of accounts involved in the instruction

pubkey
string

The public key of the account

isSigner
boolean

A boolean indicating if the account is a signer

isWritable
boolean

A boolean indicating if the account is writable

data
string

Instruction data in base64 encoding

setupInstructions
array

The setupInstructions object which contains the following fields:

programId
string

The program ID of the token setup program

accounts
array

List of accounts involved in the instruction

pubkey
string

The public key of the account

isSigner
boolean

A boolean indicating if the account is a signer

isWritable
boolean

A boolean indicating if the account is writable

data
string

Instruction data in base64 encoding

swapInstruction
object

The swapInstruction object which contains the following fields:

programId
string

The program ID of the swap program

accounts
array

List of accounts involved in the instruction

pubkey
string

The public key of the account

isSigner
boolean

A boolean indicating if the account is a signer

isWritable
boolean

A boolean indicating if the account is writable

data
string

Instruction data in base64 encoding

cleanupInstruction
object

(Optional) The cleanupInstruction object which contains the following fields:

programId
string

The program ID of the cleanup program

accounts
array

List of accounts involved in the instruction

pubkey
string

The public key of the account

isSigner
boolean

A boolean indicating if the account is a signer

isWritable
boolean

A boolean indicating if the account is writable

data
string

Instruction data in base64 encoding

otherInstructions
array

Additional instructions if any

addressLookupTableAddresses
array

List of lookup table addresses for versioned transactions

prioritizationFeeLamports
integer

The prioritization fee in lamports

Request
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free