Skip to main content
POST
Build spot collateral swap transaction

Authorizations

Authorization
string
header
required

Bearer access token issued by /v1/auth/* login endpoints.

Body

application/json

JSON request payload for post.v1.ix.swap.

Request payload for /v1/ix/swap.

Venue configuration (venue list, base URLs, API keys, shared lookup tables, slippage bounds) is server-side; the request only selects what to swap and how to quote it.

assetIn
required

Asset sold (exact-in).

Available options:
sol
assetOut
required

Asset bought. Must differ from asset_in.

Available options:
sol
authority
string
required

Wallet the trader PDA derives from. Without position_authority it is also the swapper: sole required signer of the swap_native instruction, owner of every token account the swap touches, and the default fee payer.

amountAtoms
integer<int64> | null

Exact-in amount in atoms of asset_in (lamports for SOL, quote atoms for quote, mint atoms for spot). Exactly one of amount_atoms / quantity is required.

Required range: x >= 0
collateralAmountAtoms
integer<int64> | null

Beta quote->SOL swaps only: canonical quote collateral debited by SwapNative in quote atoms, decoupled from the venue amount. Defaults to the venue amount. Rejected on other deployments or directions.

Required range: x >= 0
computeUnitPriceMicroLamports
integer<int64> | null

Priority fee (compute unit price) in micro-lamports. A v0 transaction carries it as a compute-budget instruction; a v1 transaction carries ceil(price * compute_unit_limit / 1e6) lamports in its message config. Sponsored swaps must set fees here rather than recompiling the message, since the sponsorship attestation covers the exact compiled bytes.

Required range: x >= 0
feePayer
string | null

Fee payer for the compiled transaction; defaults to the swapper (position_authority when provided, else authority). Does not change the swap's signer, only who pays the transaction fee.

positionAuthority
string | null

Position authority delegated on the trader account. When provided it becomes the swapper: it signs swap_native and owns the staged token accounts in place of authority. The trader PDA still derives from authority.

quantity
number<double> | null

Exact-in amount in whole units of asset_in (e.g. 0.5 SOL); converted server-side using the input asset's decimals. Exactly one of amount_atoms / quantity is required.

slippageBps
integer<int32> | null

Slippage tolerance override in basis points; clamped to the server-configured maximum.

Required range: x >= 0
traderPdaIndex
integer<int32> | null

Which of the authority's trader PDAs the swap settles collateral against; defaults to 0.

Required range: x >= 0
traderSubaccountIndex
integer<int32> | null

Subaccount of the selected trader PDA the swap settles collateral against; defaults to 0 (cross-margin).

Required range: x >= 0
transactionVersion
integer<int32> | null

Transaction format to compile: 0 (default) for a v0 message with address lookup tables, 1 for a v1 message (SIMD-0385) that inlines every address and carries the compute budget in its config instead of compute-budget instructions. Other values are rejected.

Required range: x >= 0
venue
string | null

Restrict planning to the venue with this id from the server config (e.g. "jupiter"). By default every configured venue is quoted and the best minimum output wins.

Response

Successful response

Response payload for /v1/ix/swap.

Carries the same plan twice: a compiled unsigned transaction for clients that sign and send as-is, and the instruction/lookup-table breakdown for clients that compile their own message (own blockhash, fee payer, and safety instructions).

addressLookupTableAddresses
string[]
required

Address lookup tables the instructions require. A swap route does not fit in a legacy transaction, so client-side compilation must load these tables and compile a v0 message. Empty for v1.

amountInAtoms
integer<int64>
required

Venue-leg input amount in atoms of the input asset, after deducting the server-configured swap fee.

Required range: x >= 0
blockhash
string
required

Recent blockhash the transaction was compiled against.

computeUnitLimit
integer<int32>
required

Compute unit limit set on the compiled transaction.

Required range: x >= 0
contextSlot
integer<int64>
required

Slot the venue quoted at.

Required range: x >= 0
expectedAmountOutAtoms
integer<int64>
required

Venue's quoted output in atoms of the output asset.

Required range: x >= 0
instructions
object[]
required

The transaction's instructions for clients compiling their own message: compute budget first for v0, none for v1, then the swap.

lastValidBlockHeight
integer<int64>
required

Last block height at which blockhash (and therefore transaction) is valid.

Required range: x >= 0
minAmountOutAtoms
integer<int64>
required

Minimum output enforced on-chain, derived from the slippage tolerance.

Required range: x >= 0
priceImpactBps
integer<int32>
required

Venue-reported price impact in basis points.

Required range: x >= 0
swapNativeAmountInAtoms
integer<int64>
required

SwapNative's collateral amount_in, including the swap fee; overridden on a beta buy with collateral_amount_atoms set.

Required range: x >= 0
transaction
string
required

Base64 wire bytes of the unsigned transaction (placeholder signatures) in the format transaction_version names, compiled against blockhash. v0 carries the compute budget as instructions and loads the resolved lookup tables; v1 carries it in the message config.

transactionVersion
integer<int32>
required

Message version of transaction: 0 or 1.

Required range: x >= 0
venue
string
required

Venue id that won the quote.

attestationExpiresAt
integer<int64> | null

Unix time at which sponsorship_attestation expires.

sponsorshipAttestation
string | null

Provenance attestation over the compiled message, for the sponsorship server. Present only when the server has an attestation key configured. Issued for the swapper (position_authority when provided, else authority). Sign transaction verbatim and pass this through to POST /v1/sponsorship/transaction; any recompilation invalidates it.