Jupiter API Guide: Swap, Quote, and Price Endpoints for Solana Developers
Jupiter API Guide: Swap, Quote, and Price Endpoints for Solana Developers
Jupiter is the leading DEX aggregator on Solana, routing trades across dozens of decentralized exchanges to find the best prices. Whether you're building a trading bot, DeFi application, or wallet integration, Jupiter's APIs provide everything you need.
This guide covers Jupiter's APIs comprehensively, from basic concepts to advanced usage patterns.
🎯 What You'll Learn
- Overview of Jupiter's API offerings
- How to get price quotes using the Quote API
- Building and executing swap transactions
- Using the Price API for token prices
- Rate limits and best practices
📡 Jupiter API Overview
Jupiter provides several APIs for different use cases:
API Types
| API | Purpose | Best For |
|---|---|---|
| Ultra Swap API | Complete swap solution | New integrations |
| Legacy Swap API | Custom swap building | Advanced customization |
| Price API | Token price data | Price feeds, analytics |
Which API Should You Use?
Ultra Swap API (Recommended):
- Simplest integration
- Handles RPC, fees, slippage automatically
- Best transaction landing rates
- No RPC maintenance needed
Legacy Swap API:
- Need custom instructions
- Want to choose broadcasting method
- Require CPI (Cross Program Invocation)
- Need specific DEX routing control
Price API:
- Need current token prices
- Building price feeds
- Portfolio tracking
🔗 API Endpoints
Base URLs
Ultra Swap API: https://lite-api.jup.ag/ultra/v1
Legacy Swap API: https://lite-api.jup.ag/swap/v1
Price API: https://api.jup.ag/price/v2
Important Note
Jupiter is deprecating lite-api.jup.ag on January 31, 2026. Migrate to the new endpoints when available.
💱 Ultra Swap API
The Ultra Swap API is Jupiter's recommended solution for new integrations.
Key Features
- RPC-less: No need to maintain your own RPC
- Automatic optimization: Best slippage, fees, routing
- Sub-second landing: Proprietary transaction engine
- MEV protection: Built-in protection from frontrunning
Get a Quote
Endpoint: GET /order
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
inputMint |
string | Yes | Token address to sell |
outputMint |
string | Yes | Token address to buy |
amount |
string | Yes | Amount in smallest units (lamports) |
taker |
string | Yes | Wallet address executing swap |
Example Request:
GET https://lite-api.jup.ag/ultra/v1/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=100000000&taker=YOUR_WALLET_ADDRESS
Example Response:
{
"requestId": "abc123...",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"inAmount": "100000000",
"outAmount": "19850000",
"otherAmountThreshold": "19651500",
"swapMode": "ExactIn",
"slippageBps": 50,
"priceImpactPct": "0.01",
"routePlan": [...],
"transaction": "base64_encoded_transaction..."
}
Execute the Swap
Endpoint: POST /execute
Request Body:
{
"signedTransaction": "base64_encoded_signed_transaction",
"requestId": "abc123..."
}
Response:
{
"signature": "transaction_signature...",
"status": "confirmed",
"slot": 123456789
}
📜 Legacy Swap API
Use the Legacy API when you need more control over transactions.
Step 1: Get Quote
Endpoint: GET /quote
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
inputMint |
string | Yes | Token to sell |
outputMint |
string | Yes | Token to buy |
amount |
string | Yes | Amount in smallest units |
slippageBps |
number | No | Slippage tolerance (basis points) |
swapMode |
string | No | ExactIn or ExactOut |
onlyDirectRoutes |
boolean | No | Skip intermediate tokens |
maxAccounts |
number | No | Limit accounts (for Ledger) |
Example:
GET https://lite-api.jup.ag/swap/v1/quote?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000&slippageBps=50
Response:
{
"inputMint": "So11111111111111111111111111111111111111112",
"inAmount": "1000000000",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outAmount": "198500000",
"otherAmountThreshold": "196515000",
"swapMode": "ExactIn",
"slippageBps": 50,
"priceImpactPct": "0.05",
"routePlan": [
{
"swapInfo": {
"ammKey": "...",
"label": "Raydium",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"inAmount": "1000000000",
"outAmount": "198500000",
"feeAmount": "300000",
"feeMint": "So11111111111111111111111111111111111111112"
},
"percent": 100
}
]
}
Step 2: Build Transaction
Endpoint: POST /swap
Request Body:
{
"quoteResponse": { /* the quote object from step 1 */ },
"userPublicKey": "YOUR_WALLET_ADDRESS",
"wrapAndUnwrapSol": true,
"dynamicComputeUnitLimit": true,
"prioritizationFeeLamports": "auto"
}
Optional Parameters:
| Parameter | Description |
|---|---|
computeUnitPriceMicroLamports |
Priority fee in micro-lamports |
dynamicSlippage |
Auto-adjust slippage |
feeAccount |
Token account for referral fees |
asLegacyTransaction |
Return legacy transaction |
Response:
{
"swapTransaction": "base64_encoded_transaction...",
"lastValidBlockHeight": 123456789
}
Step 3: Sign and Send
- Decode the base64 transaction
- Sign with your wallet
- Send to the network
- Implement backoff: Wait and retry on 429 errors
- Cache responses: Don't request same data repeatedly
- Batch requests: Use comma-separated mints for prices
- User enters amount to swap
- Call Quote API to get rates
- Display quote to user
- On confirm, call Swap API
- Sign and send transaction
- Display confirmation
- Stable pairs (USDC/USDT): 0.1% (10 bps)
- Major tokens (SOL/USDC): 0.5% (50 bps)
- Low liquidity tokens: 1-5% (100-500 bps)
- Jupiter Developer Docs - Complete API reference
- Jupiter Discord - Developer support
- Raydium API - Direct DEX access
- Orca API - Whirlpool integration
- Jupiter Terminal - Embeddable swap widget
- Jupiter Stats - Trading analytics
- Use Ultra Swap API for new integrations - it's simpler and better optimized
- Price API is separate from Quote API - use the right one
- Always check price impact before large trades
- Handle rate limits with proper backoff
- Cache where possible to reduce API calls
- Validate responses before processing
💵 Price API
Get real-time token prices from Jupiter.
Single Token Price
Endpoint: GET /price
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
ids |
string | Yes | Comma-separated token addresses |
vsToken |
string | No | Quote token (default: USDC) |
Example:
GET https://api.jup.ag/price/v2?ids=So11111111111111111111111111111111111111112
Response:
{
"data": {
"So11111111111111111111111111111111111111112": {
"id": "So11111111111111111111111111111111111111112",
"mintSymbol": "SOL",
"vsToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"vsTokenSymbol": "USDC",
"price": 198.50
}
},
"timeTaken": 0.002
}
Multiple Token Prices
GET https://api.jup.ag/price/v2?ids=So11111111111111111111111111111111111111112,JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN
Price vs Different Quote Token
GET https://api.jup.ag/price/v2?ids=JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN&vsToken=So11111111111111111111111111111111111111112
This returns the price of JUP in terms of SOL.
⚙️ Rate Limits
Free Tier Limits
| API | Rate Limit |
|---|---|
| Quote API | 60 requests/minute |
| Swap API | 60 requests/minute |
| Price API | 600 requests/minute |
How to Handle Rate Limits
🛠️ Common Use Cases
Building a Swap Interface
Price Feed for Portfolio
// Get prices for multiple tokens
const tokens = [
"So11111111111111111111111111111111111111112", // SOL
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
"JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN" // JUP
].join(",");
fetch(`https://api.jup.ag/price/v2?ids=${tokens}`)
.then(res => res.json())
.then(data => {
// Process prices
});
Adding Referral Fees
You can earn fees on swaps using the feeAccount parameter:
{
"quoteResponse": { ... },
"userPublicKey": "USER_ADDRESS",
"feeAccount": "YOUR_FEE_TOKEN_ACCOUNT"
}
🔧 Best Practices
1. Handle Errors Gracefully
try {
const response = await fetch(quoteUrl);
if (!response.ok) {
if (response.status === 429) {
// Rate limited - wait and retry
await sleep(1000);
return retry();
}
throw new Error(`API error: ${response.status}`);
}
return response.json();
} catch (error) {
// Handle network errors
}
2. Validate Responses
Always check that the response contains expected data:
const quote = await getQuote();
if (!quote.outAmount || quote.outAmount === "0") {
throw new Error("No route found for this swap");
}
3. Use Appropriate Slippage
4. Check Price Impact
const priceImpact = parseFloat(quote.priceImpactPct);
if (priceImpact > 5) {
// Warn user about high price impact
console.warn(`High price impact: ${priceImpact}%`);
}
🔗 Token Addresses
Common Solana Tokens
| Token | Address |
|---|---|
| SOL (Wrapped) | So11111111111111111111111111111111111111112 |
| USDC | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| USDT | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB |
| JUP | JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN |
| BONK | DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263 |
📚 Additional Resources
Official Documentation
Related APIs
Tools
🎓 Key Takeaways
Jupiter's APIs power the best trading experiences on Solana. Now you have everything you need to integrate! 🚀