← Protocols
Jupiter
01Description

Solana's leading swap aggregator. Smart-routes across all major Solana DEXs and AMMs with a quote/swap API and managed-execution endpoints.

02Best for
  • 01Solana swaps
  • 02best-price routing on Solana
  • 03Solana trading bots
  • 04limit/DCA orders
  • 05embedded Solana swap UX
03Install
  • pnpm add @jup-ag/api @solana/web3.js
04Environment variables
VariableScopeDescription
JUPITER_API_KEYServerJupiter API key from the dev.jup.ag developer portal. Public lite endpoint works without a key but is rate-limited.
05Prompt snippet
Use Jupiter's `@jup-ag/api` client created via `createJupiterApiClient({ basePath, apiKey })`. Call `quoteGet({ inputMint, outputMint, amount, slippageBps, swapMode })` to get a route, then `swapPost({ swapRequest: { quoteResponse, userPublicKey, wrapAndUnwrapSol: true, dynamicComputeUnitLimit: true, prioritizationFeeLamports: 'auto' } })` to receive a base64-encoded `VersionedTransaction`. Deserialize with `VersionedTransaction.deserialize(Buffer.from(swapTransaction, 'base64'))`, sign with the user's wallet, and send via `connection.sendRawTransaction`. Prefer `/swap-instructions` if you need to compose Jupiter's swap into a larger transaction.
06Gotchas
  • Always pass `slippageBps` explicitly — defaults are not safe for volatile pairs; consider Jupiter's `/swap` `dynamicSlippage` flag.
  • Jupiter swap transactions are large versioned txs with address-lookup tables; you must use `VersionedTransaction`, not legacy `Transaction`.
  • Set `dynamicComputeUnitLimit: true` and `prioritizationFeeLamports: 'auto'` or your tx will likely time out under load.
  • Quotes go stale within seconds on Solana — re-quote on user confirmation; `otherAmountThreshold` from the quote must be respected.
  • Free/lite endpoint has aggressive rate limits; production apps need an API key — legacy portal limits expire 30 June 2026.
  • Token-2022 mints with transfer hooks/fees must be handled explicitly — not all routes support them.
07Alternatives