Skip to main content
POST
Build the swap (alias of /swap-instructions)
The same handler as POST /swap-instructions, under Jupiter’s path name.
Unlike Jupiter’s /swap, it returns instructions and no swapTransaction unless the body sets "serialize": true.

Authorizations

x-api-key
string
header
required

Body

application/json
userPublicKey
string
required

The wallet that signs and pays: fee payer, source of the input, owner of every intermediate account. Alias wallet

quoteResponse
object

A quote to build as it is (no re-quote). Takes precedence over routeTicket and the pair fields

routeTicket
string

The routeTicket of a quote, instead of quoteResponse. A router without tickets (the public one) answers 400 invalid_route_ticket

inputMint
string

Pair mode (no quote): the mint you spend. With a quote or ticket, if present, must match it

outputMint
string

Pair mode: the mint you receive. With a quote or ticket, if present, must match it

amount

Pair mode: u64 amount, as in /quote. With a ticket, if present, must match it

swapMode
enum<string>
default:ExactIn

Pair mode only

Available options:
ExactIn,
ExactOut,
exactIn,
exactOut
slippageBps
integer

Overrides the slippage of the quote or ticket; pair-mode default 50. Above 10000 is taken as 10000. Must be a JSON number

maxHops
integer

Pair mode only

onlyDirectRoutes
boolean

Pair mode only

dexes

Pair mode only. Alias includeDex

excludeDexes

Pair mode only. Alias excludeDex

allowSplit
boolean
default:false

Pair mode only; a split quote is built as a split anyway

forJitoBundle
boolean
default:false

Pair mode only

reserveKeys
integer
default:0

Pair mode only

wrapAndUnwrapSol
boolean
default:true

true: SOL input is wrapped from the wallet's lamports and its wSOL account closed after the swap; SOL output is unwrapped back to the wallet (not when destinationTokenAccount is another wallet). false: the route spends from and pays into the wallet's wSOL account. Alias unwrapSol

feeAccount
string

The integrator fee wallet (not a token account): a token-side fee goes to its associated token account, created if missing; a SOL-side fee is paid to the wallet itself. Must differ from userPublicKey. Required when the quote priced a platform fee. Alias feeWallet

feeBps
integer

The fee in basis points. Pinned quote: must equal platformFee.feeBps when the quote priced one. On a quote that priced no fee it is added at build time and lowers the floor, so up to feeBps less than the quoted outAmount can arrive. Pair mode: priced like platformFeeBps, only with feeAccount

feeOnInput
boolean

As in /quote; must match a priced quote

prioritizationFeeLamports

The priority fee, Jupiter style. A number is the total in lamports. "auto" takes the 75th percentile of recent prioritization fees, within 10,000 and 1,000,000 micro-lamports per compute unit. priorityLevelWithMaxLamports is auto capped at maxLamports (priorityLevel is ignored). jitoTipLamports adds a tip transfer to a Jito tip account instead of a priority fee. Absent means no priority fee. The fee is charged on the declared compute-unit limit, not on the units used.

computeUnitPriceMicroLamports
integer

Priority price per compute unit (micro-lamports)

transactionsFeeLamports
integer

Older name of a total priority fee in lamports; wins over every other priority field

tipWallet
string

With tipLamports: a System transfer of the tip to this wallet, in otherInstructions. Wins over jitoTipLamports

tipLamports
integer

With tipWallet; 0 or absent is no tip

destinationTokenAccount
string

The wallet that receives the output; the route delivers to its associated token account, created if missing. A token account here is 400 bad_recipient (an SPL multisig is accepted, as a wallet). When the last hop pays native SOL (a venue's native leg) the output can only go to userPublicKey: another wallet is 422 declined wire. Default userPublicKey. Alias recipient

txVersion
integer
default:1

The integer 1, or absent. 0 and any other number are 400 bad_request; a string such as "v1" (the response's spelling) is a parse error, 400 without quoteId

asLegacyTransaction
boolean
serialize
boolean
default:false

Also return the unsigned transaction (swapTransaction) and lastValidBlockHeight

Response

The instructions and, with serialize, the unsigned transaction

computeBudgetInstructions
object[]
required

Always empty in v1 (the budget is transactionConfig)

setupInstructions
object[]
required

Before the swap: create the token accounts (idempotent), wrap SOL, initialize venue accounts

swapInstruction
object
required

The first swap instruction (program = your deploy)

swapInstructions
object[]
required

Every swap instruction in order: one, or two for a split. Sign all of them

otherInstructions
object[]
required

Everything after: further closes, the tip

addressLookupTableAddresses
string[]
required

Always empty

quoteId
string
required
buildId
string
required

32 hex digits identifying this build

shape
enum<string>
required

exact_out: one hop with a pinned output and an input cap. Any other ExactOut (several hops, or a venue without an exact-output instruction) is built as an exact-in shape that spends maxAmountIn with minReturn = the requested output. native_exact_in: one hop on a venue's native-SOL leg; token_exact_in_split: two routes

Available options:
token_exact_in,
native_exact_in,
exact_out,
token_exact_in_split
inAmount
string
required
outAmount
string
required
otherAmountThreshold
string
required
swapMode
enum<string>
required
Available options:
ExactIn,
ExactOut
minReturn
integer
required

The floor the program enforces on the output. ExactOut: the requested output

maxAmountIn
integer
required

What the route deposits. ExactOut: the slippage cap (otherAmountThreshold)

computeUnits
integer
required

The compute-unit limit declared

loadedAccountsDataSize
integer
required

The loaded-accounts byte limit declared

txVersion
string
required
Allowed value: "v1"
transactionConfig
object
required

The v1 message header. An absent field is absent from the header; at runtime an absent limit counts as zero, so carry every field into the transaction you assemble

routePlan
object[]
required
costs
object
required

What the transaction takes from the wallet besides the swap input, in lamports as strings

cleanupInstruction
object

The first account close after the swap (usually the wSOL unwrap). Absent when nothing is closed

swapTransaction
string

With serialize: true: the unsigned v1 transaction, base64. Sign it with userPublicKey

lastValidBlockHeight
integer

With serialize: true: last block height of its blockhash