Build Swap Instructions
Returns raw Solana swap instructions rather than a pre-built transaction.
Path Parameters
docs-demoFor higher throughput, create your own API key.
Query Parameters
Mint address of the input token.
Mint address of the output token.
Amount of the input token to swap, in its smallest unit (lamports for SOL, base units for SPL tokens).
Public key of the wallet that will sign the swap instructions. Required for /build since the instructions must reference concrete source and destination accounts.
Wallet that sponsors rent and account creation for taker. The taker still signs and pays the trade amount. To have this wallet also pay signature and priority fees, set it as the fee payer when you assemble the transaction. Any valid public key can be used; it has no effect when equal to taker.
50Slippage tolerance in basis points, 0–10000.
rtse (automatic slippage) is not supported.
Comma-separated list of DEX labels to allow-list for routing (labels are case-sensitive). Mutually exclusive with excludeDexes.
Comma-separated list of DEX labels to exclude from routing (labels are case-sensitive). Mutually exclusive with dexes.
Integrator fee in basis points (0–10000). When greater than zero, feeAccount is required. Mutually exclusive with referralFee and referralAccount.
Token account that receives the integrator fee. Required when platformFeeBps is greater than zero. Only validated as a public key. Mutually exclusive with referralFee and referralAccount.
Maximum number of accounts the selected route may use, from 1 to 64. Lower values may restrict available routes.
When true, Metis inserts wrap-SOL and unwrap-SOL instructions around the swap so native SOL can be used directly as input or output.
Explicit destination SPL token account for the output tokens. Mutually exclusive with nativeDestinationAccount.
Explicit destination wallet for native SOL output. Mutually exclusive with destinationTokenAccount.
Number of slots the returned blockhash remains valid for, from 1 to 255.
Not supported.
Priority-fee level to target: medium (25th percentile), high (50th), or veryHigh (75th). If omitted, the 50th percentile is used. Numeric percentiles are not supported. The total priority fee is capped at 1,000,000 lamports.
Only fast is accepted; it currently has no effect on routing.
Set to true when quoting a swap intended for a Jito bundle. Forwarded to the routing engine.
Integrator fee in basis points (50–255). Must be sent with referralAccount. Mutually exclusive with platformFeeBps and feeAccount.
Referral account in the referral program. Must be sent with referralFee. The fee is charged in the output token and paid into that mint’s fee token account under this referral account. That token account must already exist. Mutually exclusive with platformFeeBps and feeAccount.
Responses
200
Quote fields plus decomposed swap instructions.