Skip to main content
POST
Build swap instructions

Body

application/json
userPublicKey
string
required

Wallet that signs and pays for the swap

quoteResponse
object
required

Quote returned by GET /quote. Send it back unchanged as quoteResponse.

wrapUnwrapSol
boolean
default:true

Wrap and unwrap native SOL automatically

txVersion
enum<string>
default:V0

Transaction format. Case-sensitive. LEGACY and V1 do not support JIT routes; quote with jitRouting=false to use them.

Available options:
V0,
LEGACY,
V1
priorityFee
string

A level (min, low, medium, auto, high, veryHigh, turbo, unsafeMax) or a total fee in lamports as a string, such as "50000". Default auto.

Example:

"high"

maxPriorityFee
integer

Cap on the compute unit price, in micro-lamports

computeUnitPriceMicroLamports
integer

Exact compute unit price in micro-lamports. Overrides priorityFee.

computeUnitLimit
integer

Compute unit limit

tipAccount
string

Account that receives a SOL tip, such as a Jito tip account

tipLamports
integer

Tip amount in lamports

feeAccount
string

Wallet that receives your platform fee

feeBps
integer

Platform fee in basis points

feeFromInput
boolean
default:false

Take the platform fee from the input token

chargeBps
integer

Fee on positive slippage, in basis points

jitRouting
enum<string>
default:auto

On /swap, auto keeps the quote's route. On /swap-instructions, you get a JIT swap only when this is true.

Available options:
auto,
true,
false

Response

Instructions

Put the instructions in this order: computeBudgetInstructions, setupInstructions, tokenLedgerInstruction, swapInstruction, cleanupInstruction, tipInstruction. Skip any that are null. Exception: if topLevelOnly is true, swapInstruction must be last.

computeBudgetInstructions
object[]
setupInstructions
object[]

Creates missing token accounts and wraps SOL

tokenLedgerInstruction
object | null
swapInstruction
object
cleanupInstruction
object | null

Unwraps SOL

tipInstruction
object
addressLookupTableAddresses
string[]

Address lookup tables to load when compiling a V0 transaction

topLevelOnly
boolean

true for a JIT swap: swapInstruction must be the last instruction and must not be called through CPI

quoteResponse
object

The quote these instructions were built for. Use its amounts.

transactionConfig
object

Compute budget settings, returned when txVersion is V1