POST /swap

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

post/swap

Request body

userPublicKeystring required

The user public key.

wrapAndUnwrapSolboolean

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

useSharedAccountsboolean

Default is true. 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.

feeAccountstring

Fee token account for the output token, it is derived using the seeds = ["referral_ata", referral_account, mint] and the REFER4ZgmyYx9c6He5XfaTMiGfdLwRnkV4RPp9t9iF3 referral contract (only pass in if you set a platformFeeBps in /quote and make sure that the feeAccount has been created).

{"stackTrail":"components:schemas:SwapRequest:properties:computeUnitPriceMicroLamports","oasType":"schema","type":"unknown","description":"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."}
{"stackTrail":"components:schemas:SwapRequest:properties:prioritizationFeeLamports","oasType":"schema","type":"unknown","description":"Prioritization fee lamports paid for the transaction in addition to the signatures fee. Mutually exclusive with compute_unit_price_micro_lamports. If `auto` is used, Jupiter will automatically set a priority fee and it will be capped at 5,000,000 lamports / 0.005 SOL."}
asLegacyTransactionboolean

Default is false. 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.

restrictIntermediateTokensboolean

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.

useTokenLedgerboolean

Default is false. This is useful when the instruction before the swap has a transfer that increases the input token amount. Then, the swap will just use the difference between the token ledger token amount and post token amount.

destinationTokenAccountstring

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.

dynamicComputeUnitLimitboolean

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. Default is false.

skipUserAccountsRpcCallsboolean

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.

Response

Successful response

swapTransactionstring required
lastValidBlockHeightnumber required
prioritizationFeeLamportsnumber

Changes