メインコンテンツへスキップ
POST
/
v1
/
swap
/
swap
curl --request POST \ --url https://payments.magicblock.app/v1/swap/swap \ --header 'Content-Type: application/json' \ --data ' { "userPublicKey": "3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE", "quoteResponse": { "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "inAmount": "1000000", "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", "outAmount": "999519", "otherAmountThreshold": "994522", "swapMode": "ExactIn", "slippageBps": 50, "priceImpactPct": "0", "routePlan": [] } } '
{ "swapTransaction": "AQABA...base64...", "lastValidBlockHeight": 318120000 }

ボディ

application/json
userPublicKey
string
必須

Public key of the wallet that will sign the swap transaction.

:

"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE"

quoteResponse
object
必須

Quote response from GET /v1/swap/quote.

payer
string

Optional fee payer for transaction fees and rent.

:

"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE"

wrapAndUnwrapSol
boolean

Automatically wrap and unwrap native SOL when needed.

:

true

useSharedAccounts
boolean

Allow shared accounts for intermediate routing state.

:

true

feeAccount
string

Optional initialized token account used to collect platform fees.

trackingAccount
string

Optional public key used for downstream transaction tracking.

prioritizationFeeLamports

Optional priority fee configuration or fixed lamport amount.

必須範囲: x >= 0
asLegacyTransaction
boolean

Build a legacy transaction instead of a versioned one. Not allowed when visibility = "private".

destinationTokenAccount
string

Optional destination token account for the output mint. When visibility = "private", this is server-controlled and must match the derived stash ATA.

nativeDestinationAccount
string

Optional destination account for native SOL output. Not supported when visibility = "private".

dynamicComputeUnitLimit
boolean

Estimate compute usage and set the compute unit limit automatically.

skipUserAccountsRpcCalls
boolean

Skip extra RPC checks for required user accounts.

dynamicSlippage
boolean

Let the upstream swap builder overwrite slippage on the transaction.

computeUnitPriceMicroLamports
integer

Optional exact compute unit price in micro-lamports.

必須範囲: x >= 0
blockhashSlotsToExpiry
integer

Optional transaction expiry window in slots.

必須範囲: x >= 0
positiveSlippage
object

Optional positive slippage collection settings.

visibility
enum<string>

public (default) proxies Jupiter/Metis as-is. private routes the output through a scheduled private transfer.

利用可能なオプション:
public,
private
:

"public"

destination
string

Final private-transfer recipient (wallet pubkey). Required when visibility = "private".

minDelayMs
string

Earliest (ms) the queued transfer may settle. Required when visibility = "private".

Pattern: ^\d+$
:

"0"

maxDelayMs
string

Latest (ms) the queued transfer may settle. Required when visibility = "private". Must be >= minDelayMs and <= 600000 (10 minutes).

Pattern: ^\d+$
:

"60000"

split
integer

Number of queue entries to split the transfer across. Required when visibility = "private". Must be between 1 and 14.

必須範囲: 1 <= x <= 14
clientRefId
string

Optional u64 client correlation id attached to each queued split.

Pattern: ^\d+$
validator
string

Optional validator pubkey for the transfer-queue PDA. Defaults to the well-known MagicBlock validator (MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57).

レスポンス

Swap transaction

swapTransaction
string
必須

Base64-encoded unsigned transaction.

lastValidBlockHeight
integer
必須範囲: x >= 0
prioritizationFeeLamports
integer
必須範囲: x >= 0
privateTransfer
object

Present only when visibility = "private". Diagnostic metadata about the appended schedule_private_transfer instruction.