Skip to main content

swap

Returns a transaction that you can use from the quote you get from /quote.

Request Body REQUIRED
userPublicKey string REQUIRED

The user public key

wrapAndUnwrapSol boolean

Default: true

  • To automatically wrap/unwrap SOL in the transaction If false, it will use wSOL token account
  • Parameter be ignored if destinationTokenAccount is set because the destinationTokenAccount may belong to a different user that we have no authority to close.
useSharedAccounts boolean

Default: true

  • This enables the usage of shared program accounts
  • If true, no intermediate token accounts or open orders accounts need to be created for user
  • If you are using destinationTokenAccount, you must set this to true. If this is not set, this will be set to false in the case that the route plan is just through one simple AMM that isn't Openbook or Serum. Otherwise, it will be set to true
feeAccount string
  • The referral account's token account of specific mints depending on SwapMode to collect fees
  • See Add Fees guide for more details
trackingAccount string
  • Specify any public key that belongs to you to track the transactions
  • Useful for integrators to get all the swap transactions from this public key
  • Use this endpoint https://stats.jup.ag/tracking-account/:public-key/YYYY-MM-DD/HH
prioritizationFeeLamports integer
  • To specify a level or amount of additional fees to prioritize the transaction
  • It can be used for both priority fee and jito tip
priorityLevelWithMaxLamports
prorityLevel string

Either medium, high or veryHigh

maxLamports

Maximum lamports to cap the priority fee estimation, to prevent overpaying

jitoTipLamports
jitoTipLamports integer
  • Exact amount of tip to use in a tip instruction
  • Estimate how much to set using Jito tip endpoint, see their docs
asLegacyTransaction boolean

Default: false

  • Request a legacy transaction rather than the default versioned transaction
  • Used together with asLegacyTransaction in /quote, otherwise the transaction might be too large
useTokenLedger boolean

Default: false

  • This is useful when the instruction before the swap has a transfer that increases the input token amount
  • Then, the swap will use the difference between the token ledger token amount and post token amount
destinationTokenAccount string
  • Public key of a token account that will be used to receive the token out of the swap
  • If not provided, the signer's ATA will be used
  • If provided, we assume that the token account is already initialized
dynamicComputeUnitLimit boolean

Default: false

  • 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
  • This can be useful to estimate compute unit correctly and reduce priority fees needed or have higher chance to be included in a block
skipUserAccountsRpcCalls boolean

Default: false

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

Default: false

  • When enabled, it will use a set of categories and math to calculate a dynamic slippage threshold to use
  • See dynamic slippage notes
computeUnitPriceMicroLamports integer
  • To specify a compute unit price to calculate priority fee
  • 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
  • We recommend using prioritizationFeeLamports and dynamicComputeUnitLimit instead of passing in a compute unit price
quoteResponse object REQUIRED
inputMint string REQUIRED
inAmount string REQUIRED
outputMint string REQUIRED
outAmount string REQUIRED
  • Calculated output amount from routing algorithm
  • Exlcuding network fees, slippage or platform fees
otherAmountThreshold string REQUIRED
  • Calculated minimum output amount after accounting for slippageBps and platformFeeBps
  • Not used by build transaction
swapMode string REQUIRED

Possible values: [ExactIn, ExactOut]

slippageBps int32 REQUIRED
platformFee object
amount string
feeBps int32
priceImpactPct string REQUIRED
routePlan object[] REQUIRED
swapInfo object REQUIRED
ammKey string REQUIRED
label string
inputMint string REQUIRED
outputMint string REQUIRED
inAmount string REQUIRED
outAmount string REQUIRED
feeAmount string REQUIRED
feeMint string REQUIRED
percent int32 REQUIRED
contextSlot number
timeTaken number

Time taken to determine quote

Responses
200

Successful response

Schema OPTIONAL
swapTransaction string
lastValidBlockHeight number
prioritizationFeeLamports number OPTIONAL
dynamicSlippageReport object OPTIONAL
slippageBps int32 OPTIONAL
otherAmount int32 OPTIONAL
simulatedIncurredSlippageBps int32 OPTIONAL
amplificationRatio string OPTIONAL