The Router path uses theDocumentation Index
Fetch the complete documentation index at: https://dev.jup.ag/docs/llms.txt
Use this file to discover all available pages before exploring further.
/build endpoint to return raw swap instructions instead of an assembled transaction. Routing is handled by Metis, Jupiter’s onchain routing engine, which finds the best path across Solana DEXes.
You build the transaction yourself, giving you full control to add custom instructions, CPI, or modify any part of the transaction. Once built and signed, submit via your own RPC or use /submit to land through Jupiter’s transaction infrastructure with SOL tips.
Quick start
Prerequisites
Imports, types, and helpers
Imports, types, and helpers
Code example
How it works
1. Call /build
GET /build returns a quote and all the instructions you need to build a swap transaction.
Required parameters:
| Parameter | Description |
|---|---|
inputMint | Mint address of the token you are selling |
outputMint | Mint address of the token you are buying |
amount | Amount in the smallest unit of the input token |
taker | Your wallet address |
| Field | Description |
|---|---|
computeBudgetInstructions | Compute unit price instruction (does not include compute unit limit) |
setupInstructions | Pre-swap setup (e.g. ATA creation) |
swapInstruction | The main swap instruction |
cleanupInstruction | Post-swap cleanup (may be null) |
otherInstructions | Additional instructions |
tipInstruction | SOL tip transfer instruction (present when tipAmount is provided) |
addressesByLookupTableAddress | Address lookup tables for v0 transactions |
blockhashWithMetadata | Recent blockhash and expiry height |
2. Add your own instructions
Insert custom instructions alongside the swap instructions. Common examples:- SOL transfer (tip or payment)
- Memo instruction
- Create or close token accounts
- Custom program CPI
3. Simulate compute unit limit
The/build response includes computeBudgetInstructions with the compute unit price but not the compute unit limit. You need to simulate the transaction to determine the correct limit.
Why: integrators using /build typically add their own instructions, so the CU usage will differ from the base swap. The simulation gives you the actual CU consumed, and you set the limit to 1.2x that value (capped at 1,400,000).
Both code examples above demonstrate this: simulate with max CU limit, then rebuild with 1.2x the simulated value plus the CU price from the response. See Solana fee structure for more on compute units and Estimate Compute Units for a standalone guide.
4. Build a v0 transaction
The response includes address lookup tables inaddressesByLookupTableAddress. Use these to compile a v0 (versioned) transaction, which supports more accounts than legacy transactions.
5. Sign and send
Sign the transaction with your wallet and send via your own RPC, or use/submit to land them through Jupiter’s transaction infrastructure with SOL tips.
/build transactions cannot use /execute./builddoes not have the requiredrequestId/buildis intended for customisations, and/executevalidates the transaction to prevent any changes
Router vs Meta-Aggregator
Meta-Aggregator (/order) | Router (/build) | |
|---|---|---|
| Routing | All engines (Metis, JupiterZ, Dflow, OKX) | Metis only |
| Swap fees | Jupiter platform fee | None |
| Transaction landing | Managed via /execute | Self-managed or use Jupiter’s proprietary transaction landing pipeline via /submit |
| Transaction control | None | Full |
| Compute budget | Included in transaction | Included as instructions (you can override) |
Optional parameters
| Parameter | Default | Description |
|---|---|---|
slippageBps | 50 | Slippage tolerance in basis points, or "rtse" for RTSE |
tipAmount | - | SOL tip amount in lamports. Adds a tip instruction for use with /submit |
computeUnitPricePercentile | - | Priority fee percentile for the CU price instruction. Named levels: "medium" (25th), "high" (50th), "veryHigh" (75th), or an integer 0-10000 in bps. See Compute Units |
mode | (default) | “fast” for reduced latency routing (BETA) |
maxAccounts | 64 | Maximum accounts for the swap route (1-64) |
platformFeeBps | 0 | Integrator platform fee in bps (requires feeAccount) |
feeAccount | - | Token account to collect platform fees |
payer | public key | Account that pays transaction fees and rent |
wrapAndUnwrapSol | true | Whether to wrap/unwrap SOL automatically |
dexes | (all) | Restrict routing to specific DEXes |
excludeDexes | (none) | Exclude specific DEXes from routing |
destinationTokenAccount | - | SPL token account for output |
nativeDestinationAccount | - | Native SOL account for output |
blockhashSlotsToExpiry | 150 | Slots until blockhash expires (1-300) |
Fees
Jupiter does not charge swap fees on/build. The only fee mechanism is integrator platform fees via platformFeeBps and feeAccount:
feeAccount can be any SPL token account you control (it does not need to be a referral program account). You are responsible for creating and managing this account.
Related
- Transaction Submission to submit via Jupiter’s transaction landing infrastructure with SOL tips for priority processing
- Common Instructions for common instructions to compose with your swap
- Advanced Techniques for CU simulation,
mode: "fast", andmaxAccounts - API Reference: GET /build for the full OpenAPI specification
