---
title: "swap-instructions"
method: POST
path: "/swap-instructions"
tags: ["Swap"]
---

# swap-instructions

`POST /swap-instructions`

Request for swap instructions that you can use from the quote you get from `/quote`

## Request body

- SwapRequest
  - `userPublicKey` string, required
  - `payer` string — - Allow a custom payer to pay for the transaction fees and rent of token accounts - Note that users can close their ATAs elsewhere and have you reopen them again, your fees should account for this
  - `wrapAndUnwrapSol` boolean — - To automatically wrap/unwrap SOL in the transaction, as WSOL is an SPL token while native SOL is not - When true and input mint is SOL, it will wrap the SOL amount to WSOL and swap - When true and output mint is SOL, it will unwrap the WSOL back to SOL - When false and input mint is SOL, it will use existing WSOL amount to swap - When false and output mint is SOL, it will not unwrap the WSOL to SOL - To set this parameter to false, you need to have the WSOL token account initialized
  - `useSharedAccounts` boolean — - The default is determined dynamically by the routing engine, allowing us to optimize for compute units, etc - This enables the usage of shared program accounts, this is essential as complex routing will require multiple intermediate token accounts which the user might not have - If true, you do not need to handle the creation of intermediate token accounts for the user - Do note, shared accounts route will fail on some new AMMs (low liquidity token)
  - `feeAccount` string — - An initialized token account that will be used to collect fees - The mint of the token account **can only be either the input or output mint of the swap** - Swap API no longer requires the use of the Referral Program - If `platformFeeBps` is passed in `/quote`, the `feeAccount` must be passed as well
  - `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 - Query the data using a block explorer like Solscan/SolanaFM or query like Dune/Flipside
  - `prioritizationFeeLamports` union — - To specify a level or amount of additional fees to prioritize the transaction - It can be used for EITHER priority fee OR Jito tip (not both at the same time) - If you want to include both, you will need to use `/swap-instructions` to add both at the same time - Defaults to `auto`, but preferred to use `priorityLevelWithMaxLamports` as it may be more accurate when accounting local fee market - Fixed lamports can be passed in as an integer in the `prioritizationFeeLamports` parameter
    - PriorityLevelWithMaxLamports
      - `priorityLevelWithMaxLamports` object, required
        - `priorityLevel` 'medium' | 'high' | 'veryHigh', required
        - `maxLamports` integer, required — - Maximum lamports to cap the priority fee estimation, to prevent overpaying
        - `global` boolean — - A boolean to choose between using a global or local fee market to estimate. If `global` is set to `false`, the estimation focuses on fees relevant to the **writable accounts** involved in the instruction.
    - JitoTipLamports
      - `jitoTipLamports` integer, required — - Exact amount of tip to use in a tip instruction - Refer to Jito docs on how to estimate the tip amount based on percentiles - It has to be used together with a connection to a Jito RPC - See their docs at https://docs.jito.wtf/
    - JitoTipLamportsWithPayer
      - `jitoTipLamportsWithPayer` object, required
        - `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 — - Builds a legacy transaction rather than the default versioned transaction - Used together with `asLegacyTransaction` in `/quote`, otherwise the transaction might be too large
  - `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 token account will be used - If provided, we assume that the token account is already initialized - `destinationTokenAccount` and `nativeDestinationAccount` are mutually exclusive
  - `nativeDestinationAccount` string — - Public key of an account that will be used to receive the native SOL token out of the swap - If not provided, the swap will default unwrap the WSOL and transfer the native SOL to the swap authority account - If provided, we will unwrap the WSOL and transfer the native SOL to the account - Only works if the output mint is SOL, is using the V2 instructions and the account passed in is not owned by token program - When sending native SOL to a new account, you must swap at least enough to cover the rent required to create it. - `destinationTokenAccount` and `nativeDestinationAccount` are mutually exclusive
  - `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 incurs one extra RPC call to simulate this - We recommend to enable this to estimate compute unit correctly and reduce priority fees needed or have higher chance to be included in a block
  - `skipUserAccountsRpcCalls` boolean — - When enabled, it will not do any additional RPC calls to check on required accounts - The returned swap transaction will still attempt to create required accounts regardless if it exists or not
  - `dynamicSlippage` boolean — - When enabled, it estimates slippage and apply it in the swap transaction directly, overwriting the `slippageBps` parameter in the quote response. - This is no longer maintained, we are focusing efforts on RTSE on Ultra Swap API
  - `computeUnitPriceMicroLamports` integer — - To use an exact compute unit price to calculate priority fee - `computeUnitLimit (1400000) * computeUnitPriceMicroLamports` - We recommend using `prioritizationFeeLamports` and `dynamicComputeUnitLimit` instead of passing in your own compute unit price
  - `blockhashSlotsToExpiry` integer — - Pass in the number of slots we want the transaction to be valid for - Example: If you pass in 10 slots, the transaction will be valid for ~400ms * 10 = approximately 4 seconds before it expires
  - `quoteResponse` QuoteResponse, required
    - `inputMint` string, required
    - `inAmount` string, required
    - `outputMint` string, required
    - `outAmount` string, required — - Calculated output amount from routing engine - The value includes platform fees and DEX fees, excluding slippage
    - `otherAmountThreshold` string, required — - Calculated minimum output amount after accounting for `slippageBps` on the `outAmount` value - Not used by `/swap` endpoint to build transaction
    - `instructionVersion` 'V1' | 'V2', nullable — - The version of instruction to use in the swap program
    - `swapMode` 'ExactIn' | 'ExactOut', required
    - `slippageBps` integer, required
    - `platformFee` PlatformFee
      - `amount` string
      - `feeBps` integer
    - `priceImpactPct` string, required
    - `routePlan` RoutePlanStep[], required
      - `swapInfo` SwapInfo, required
        - `ammKey` string, required
        - `label` string
        - `inputMint` string, required
        - `outputMint` string, required
        - `inAmount` string, required
        - `outAmount` string, required
      - `percent` integer, nullable
      - `bps` integer
    - `contextSlot` integer
    - `timeTaken` number

## Response `200`

Successful response

- SwapInstructionsResponse
  - `otherInstructions` Instruction[], required — - If you set jito tips using the `prioritizationFeeLamports` parameter, you will see a custom tip instruction to Jito here.
    - `programId` string, required
    - `accounts` AccountMeta[], required
      - `pubkey` string, required
      - `isSigner` boolean, required
      - `isWritable` boolean, required
    - `data` string, required
  - `computeBudgetInstructions` Instruction[], required — - To setup the compute budget for the transaction.
    - `programId` string, required
    - `accounts` AccountMeta[], required
      - `pubkey` string, required
      - `isSigner` boolean, required
      - `isWritable` boolean, required
    - `data` string, required
  - `setupInstructions` Instruction[], required — - To setup required token accounts for the users.
    - `programId` string, required
    - `accounts` AccountMeta[], required
      - `pubkey` string, required
      - `isSigner` boolean, required
      - `isWritable` boolean, required
    - `data` string, required
  - `swapInstruction` Instruction, required
    - `programId` string, required
    - `accounts` AccountMeta[], required
      - `pubkey` string, required
      - `isSigner` boolean, required
      - `isWritable` boolean, required
    - `data` string, required
  - `cleanupInstruction` Instruction
    - `programId` string, required
    - `accounts` AccountMeta[], required
      - `pubkey` string, required
      - `isSigner` boolean, required
      - `isWritable` boolean, required
    - `data` string, required
  - `addressLookupTableAddresses` string[], required — - The lookup table addresses if you are using versioned transaction.

## Changes

- **2026-07-17** `3ffe3406c673` — 1 info
  - added the new optional request property `quoteResponse/instructionVersion`
- **2025-11-24** `da69b85ffa85` — 2 warning, 1 info
  - removed the request property `quoteResponse/routePlan/items/swapInfo/feeAmount`
  - removed the request property `quoteResponse/routePlan/items/swapInfo/feeMint`
  - the request property `quoteResponse/routePlan/items/percent` became nullable
- **2025-11-05** `743e2d26177f` — 1 info
  - added the new optional request property `nativeDestinationAccount`
- **2025-10-16** `18138545f5de` — 7 breaking, 3 warning, 4 info
  - the `blockhashSlotsToExpiry` request property type/format changed from `integer`/`` to `integer`/`uint8`
  - the `computeUnitPriceMicroLamports` request property type/format changed from `integer`/`` to `integer`/`uint64`
  - the `prioritizationFeeLamports` request property type/format changed from `object`/`` to ``/``
  - the `quoteResponse/contextSlot` request property type/format changed from `number`/`` to `integer`/`uint64`
  - …10 more
- **2025-06-25** `5be338f86f7a` — 1 info
  - added the new optional request property `payer`

[Full history](https://skmtc.dev/jup-ag/apis/swap-api/changes/swap-instructions/post.md)

---

[API](https://skmtc.dev/jup-ag/apis/swap-api.md) · [All operations](https://skmtc.dev/jup-ag/apis/swap-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/jup-ag/swap-api/revisions/3ffe3406c673/schema)
