Skip to main content

POST /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 is true. If true, will automatically wrap/unwrap SOL. If false, it will use wSOL token account.

useSharedAccounts boolean

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.

feeAccount string

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).

computeUnitPriceMicroLamports integer

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

asLegacyTransaction boolean

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.

useTokenLedger boolean

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.

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.

quoteResponse object REQUIRED
inputMint string REQUIRED
inAmount string REQUIRED
outputMint string REQUIRED
outAmount string REQUIRED
otherAmountThreshold string REQUIRED
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
Responses
200

Successful response

Schema OPTIONAL
swapTransaction string
lastValidBlockHeight number