in-solana by Supanode

Jupiter Aggregator — Program ID & Overview

JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4

Jupiter is the dominant DEX aggregator on Solana. It routes swaps across multiple liquidity sources (Raydium, Orca, Meteora, Phoenix, and others) to find the best price for any token pair.

Program ID

JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4

This is Jupiter v6. Earlier versions (v1–v5) are deprecated but their program accounts remain on-chain.

How Jupiter routing works

  1. Client calls the Jupiter Quote API with input/output mints and amount.
  2. API returns one or more routes, each a chain of swaps across DEXes.
  3. Client sends the route to the Swap API, which builds the transaction.
  4. Transaction executes via Jupiter’s on-chain program, which CPI-calls each DEX in sequence.
User → Quote API → Route [Raydium → Orca → Phoenix] → Swap API → Transaction → On-chain execution

Integration via API

Most integrations use Jupiter’s HTTP API rather than direct CPI.

Get a quote

const quoteUrl = "https://quote-api.jup.ag/v6/quote";
const params = new URLSearchParams({
  inputMint: "So11111111111111111111111111111111111111112",  // SOL
  outputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
  amount: "1000000000", // 1 SOL in lamports
  slippageBps: "50",    // 0.5%
});

const quote = await fetch(`${quoteUrl}?${params}`).then(r => r.json());
console.log("Output amount:", quote.outAmount);
console.log("Price impact:", quote.priceImpactPct);

Execute a swap

const swapUrl = "https://quote-api.jup.ag/v6/swap";
const swapResult = await fetch(swapUrl, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    quoteResponse: quote,
    userPublicKey: wallet.publicKey.toBase58(),
    wrapAndUnwrapSol: true,
  }),
}).then(r => r.json());

const swapTxBuf = Buffer.from(swapResult.swapTransaction, "base64");

Key parameters

ParameterDescription
slippageBpsMaximum slippage in basis points (50 = 0.5%)
onlyDirectRoutesSkip multi-hop routes for simpler execution
asLegacyTransactionUse legacy transaction format instead of v0
maxAccountsLimit accounts to fit in a single transaction
platformFeeBpsFee charged by the integrating platform

CPI integration

For on-chain programs that need to swap within an instruction:

use jupiter_cpi::cpi;

// Jupiter CPI requires passing all accounts from the swap instruction
// The exact accounts depend on the route chosen
cpi::shared_accounts_route(
    ctx.accounts.jupiter_program.to_account_info(),
    SharedAccountsRoute {
        token_program: ctx.accounts.token_program.to_account_info(),
        program_authority: ctx.accounts.program_authority.to_account_info(),
        // ... remaining accounts from the route
    },
    route_plan,
    in_amount,
    quoted_out_amount,
    slippage_bps,
    platform_fee_bps,
)?;

FAQ

What is the difference between Jupiter v6 and earlier versions? Jupiter v6 introduced the shared accounts model for more efficient routing, reduced transaction size, and support for more DEX integrations in a single swap.

Does Jupiter charge a fee? Jupiter does not charge swap fees. Integrators can optionally add a platform fee via platformFeeBps.

Why did my Jupiter swap fail with slippage error? The price moved more than your slippageBps allowed between quoting and execution. Increase slippage or use a priority fee for faster inclusion. See the Jupiter slippage exceeded error page for details.

Updated: