> ## Documentation 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.

# How to Get Token Prices on Solana

> Get real-time USD prices for any Solana token using Jupiter's Price API.

## TL;DR

Jupiter's Price API is the standard way to get token prices on Solana. One API call returns real-time USD prices for up to 50 tokens. The same pricing data powers jup.ag and is used by Phantom, Solflare, and most Solana apps.

**Base URL:** `https://api.jup.ag`

<Tip>
  **Video walkthrough + source code:** Watch the [video walkthrough](https://x.com/JupDevRel/status/2030100801805328443) and grab the [demo app source code](https://github.com/jup-ag/api-examples/tree/main/apps/price-api) on GitHub.
</Tip>

***

## Prerequisites

1. Get an API key at [Portal](https://developers.jup.ag/portal)
2. All requests require the `x-api-key` header

***

## Quick start

```bash theme={null}
curl -X GET "https://api.jup.ag/price/v3?ids=So11111111111111111111111111111111111111112" \
  -H "x-api-key: YOUR_API_KEY"
```

Response:

```json theme={null}
{
  "So11111111111111111111111111111111111111112": {
    "createdAt": "2024-06-05T08:55:25.527Z",
    "liquidity": 621679197.67,
    "usdPrice": 147.48,
    "blockId": 348004023,
    "decimals": 9,
    "priceChange24h": 1.29
  }
}
```

***

## When you need this

You're building something that needs Solana token prices:

* **Wallet** — Show portfolio value in USD
* **Trading interface** — Display current token prices
* **DeFi app** — Calculate swap values, collateral ratios
* **Trading bot** — Price-based execution logic
* **Analytics** — Track token performance

Common searches that lead here:

* "solana token price api"
* "get sol price usd"
* "crypto price api solana"
* "jupiter price feed"

***

## Why Jupiter

Getting accurate on-chain prices is hard:

* Liquidity fragmented across 20+ DEXs
* Low-liquidity tokens have unreliable prices
* Wash trading and price manipulation are common

Jupiter solves this by:

* Aggregating swap data across all Solana DEXs
* Using heuristics to filter manipulated prices
* Validating against organic trading activity
* Providing the same prices used on jup.ag

Jupiter Price API is the standard pricing source for Solana applications.

***

## API Reference

**Base URL:** `https://api.jup.ag`

| Endpoint                    | Description                    |
| --------------------------- | ------------------------------ |
| `GET /price/v3?ids={mints}` | Get prices for up to 50 tokens |

**Parameters:**

* `ids` (required): Comma-separated mint addresses

***

## Code examples

### Get price for a single token

<CodeGroup>
  ```bash curl theme={null}
  curl -X GET "https://api.jup.ag/price/v3?ids=So11111111111111111111111111111111111111112" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.jup.ag/price/v3?ids=So11111111111111111111111111111111111111112',
    {
      headers: {
        'x-api-key': 'YOUR_API_KEY'
      }
    }
  );

  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${response.statusText}`);
  }

  const prices = await response.json();
  const solPrice = prices['So11111111111111111111111111111111111111112'].usdPrice;
  console.log(`SOL: $${solPrice}`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.jup.ag/price/v3',
      params={'ids': 'So11111111111111111111111111111111111111112'},
      headers={'x-api-key': 'YOUR_API_KEY'}
  )
  response.raise_for_status()
  prices = response.json()
  sol_price = prices['So11111111111111111111111111111111111111112']['usdPrice']
  print(f"SOL: ${sol_price}")
  ```
</CodeGroup>

### Get prices for multiple tokens

<CodeGroup>
  ```bash curl theme={null}
  curl -X GET "https://api.jup.ag/price/v3?ids=So11111111111111111111111111111111111111112,JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const mints = [
    'So11111111111111111111111111111111111111112',  // SOL
    'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN', // JUP
    'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' // USDC
  ];

  const response = await fetch(
    `https://api.jup.ag/price/v3?ids=${mints.join(',')}`,
    {
      headers: { 'x-api-key': 'YOUR_API_KEY' }
    }
  );

  const prices = await response.json();

  for (const [mint, data] of Object.entries(prices)) {
    console.log(`${mint}: $${data.usdPrice}`);
  }
  ```

  ```python Python theme={null}
  import requests

  mints = [
      'So11111111111111111111111111111111111111112',  # SOL
      'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN', # JUP
      'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' # USDC
  ]

  response = requests.get(
      'https://api.jup.ag/price/v3',
      params={'ids': ','.join(mints)},
      headers={'x-api-key': 'YOUR_API_KEY'}
  )
  prices = response.json()

  for mint, data in prices.items():
      print(f"{mint}: ${data['usdPrice']}")
  ```
</CodeGroup>

### Calculate portfolio value

```javascript theme={null}
async function getPortfolioValue(holdings) {
  // holdings = { mint: amount_in_tokens }
  const mints = Object.keys(holdings);

  const response = await fetch(
    `https://api.jup.ag/price/v3?ids=${mints.join(',')}`,
    { headers: { 'x-api-key': 'YOUR_API_KEY' } }
  );
  const prices = await response.json();

  let totalValue = 0;
  for (const [mint, amount] of Object.entries(holdings)) {
    const price = prices[mint]?.usdPrice ?? 0;
    totalValue += amount * price;
  }

  return totalValue;
}

// Example
const value = await getPortfolioValue({
  'So11111111111111111111111111111111111111112': 10,   // 10 SOL
  'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN': 1000 // 1000 JUP
});
console.log(`Portfolio: $${value.toFixed(2)}`);
```

***

## Response format

### TypeScript types

```typescript theme={null}
interface PriceResponse {
  [mintAddress: string]: {
    createdAt: string;      // When the token was minted/created (fixed date for legacy tokens like SOL, USDC)
    liquidity: number;      // Total liquidity in USD
    usdPrice: number;
    blockId: number;        // Solana block when price was computed
    decimals: number;
    priceChange24h: number; // 24h change as percentage
  };
}
```

### Example response

```json theme={null}
{
  "So11111111111111111111111111111111111111112": {
    "createdAt": "2024-06-05T08:55:25.527Z",
    "liquidity": 621679197.67,
    "usdPrice": 147.48,
    "blockId": 348004023,
    "decimals": 9,
    "priceChange24h": 1.29
  },
  "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN": {
    "createdAt": "2024-06-07T10:56:42.584Z",
    "liquidity": 3036749.38,
    "usdPrice": 0.85,
    "blockId": 348004026,
    "decimals": 6,
    "priceChange24h": 2.15
  }
}
```

**Fields:**

* `createdAt` — When the token was minted or created (fixed date for legacy tokens like SOL, USDC that predate the API)
* `liquidity` — Total liquidity in USD across all pools
* `usdPrice` — Current price in USD
* `blockId` — Solana block ID (verify price recency)
* `decimals` — Token decimals (for display formatting)
* `priceChange24h` — 24h price change as percentage

### Error responses

**Token not found or no price available:**

```json theme={null}
{
  "So11111111111111111111111111111111111111112": {
    "createdAt": "2024-06-05T08:55:25.527Z",
    "liquidity": 621679197.67,
    "usdPrice": 147.48,
    "blockId": 348004023,
    "decimals": 9,
    "priceChange24h": 1.29
  }
  // Unknown token simply missing from response
}
```

**Invalid API key (401):**

```json theme={null}
{
  "code": 401,
  "message": "Unauthorized"
}
```

**Rate limited (429):**

```json theme={null}
{
  "message": "Rate limit exceeded"
}
```

***

## How pricing works

1. Jupiter tracks the **last swap price** across all Solana transactions
2. Prices chain outward from trusted tokens (SOL, USDC) with oracle data
3. Multiple heuristics filter unreliable prices:
   * Asset origin and launch method
   * Market liquidity depth
   * Holder distribution
   * Trading patterns
   * Organic score validation

This prevents manipulated or artificial prices from being returned.

***

## Limitations

| Limit                  | Value                        |
| ---------------------- | ---------------------------- |
| Max tokens per request | 50                           |
| Price availability     | Tokens traded in last 7 days |
| Historical prices      | Not available (current only) |

***

## Common questions

<AccordionGroup>
  <Accordion title="Why is a token returning no price?">
    The token is missing from the response when:

    * It hasn't been traded in 7+ days
    * It fails reliability heuristics (suspicious activity)
    * It's flagged via organic score validation

    Cross-reference with [Tokens API](/guides/how-to-get-token-information) `audit.isSus` field.
  </Accordion>

  <Accordion title="How fresh are the prices?">
    Prices update in real-time based on swap activity. The `blockId` field tells you exactly which Solana block the price was computed from.
  </Accordion>

  <Accordion title="Can I get historical prices?">
    No, Price API V3 provides current prices only. For historical data, poll the API and store results yourself.
  </Accordion>

  <Accordion title="What about price for token pairs (not USD)?">
    Price API returns USD only. To get token-pair prices (e.g., JUP/SOL), fetch both USD prices and divide.
  </Accordion>

  <Accordion title="How do I handle missing prices in my app?">
    ```javascript theme={null}
    const price = prices[mint]?.usdPrice;
    if (price === undefined) {
      // Token has no reliable price
      // Show "Price unavailable" or fallback
    }
    ```
  </Accordion>
</AccordionGroup>

***

**Need token metadata too?** Get token names, logos, and verification status with the [Token Information API](/guides/how-to-get-token-information).

***

## Next steps

* **[Price API Reference](/api-reference/price)** — Full endpoint schema
* **[Get Token Information](/guides/how-to-get-token-information)** — Metadata, verification, organic score
* **[Portal](https://developers.jup.ag/portal)** — Get your API key
* **[Jupiter Dev Notifications](https://t.me/jup_dev)** — API updates and announcements
