DEV Community

Donny Nguyen
Donny Nguyen

Posted on

CoinMarketCap Listings API — Free to Use

Getting Crypto Prices with the CoinMarketCap Listings API

The CoinMarketCap Listings API gives you real-time cryptocurrency data without the complexity of direct CoinMarketCap integration. It's perfect for building crypto dashboards, portfolio trackers, or price alerts.

What It Does

This API returns the top cryptocurrencies ranked by market cap, including:

  • Current prices in USD
  • 24-hour volume and price changes
  • Market cap rankings
  • Circulating supply

You control how many results you get with the limit parameter. It's straightforward, lightweight, and ready to integrate.

Getting Started with Fetch

Here's a real example that fetches the top 10 cryptocurrencies:

const options = {
  method: 'GET',
  headers: {
    'X-RapidAPI-Key': 'YOUR_API_KEY_HERE',
    'X-RapidAPI-Host': 'coinmarketcap-listings-api-production.up.railway.app'
  }
};

fetch('https://coinmarketcap-listings-api-production.up.railway.app/api/listings?limit=10', options)
  .then(response => response.json())
  .then(data => {
    data.forEach(coin => {
      console.log(`${coin.name} ($${coin.quote.USD.price.toFixed(2)})`);
      console.log(`24h Volume: $${coin.quote.USD.volume_24h.toLocaleString()}`);
      console.log(`Change: ${coin.quote.USD.percent_change_24h}%\n`);
    });
  })
  .catch(error => console.error('Error:', error));
Enter fullscreen mode Exit fullscreen mode

Response Structure

Each listing includes:

{
  "id": 1,
  "name": "Bitcoin",
  "symbol": "BTC",
  "slug": "bitcoin",
  "cmc_rank": 1,
  "quote": {
    "USD": {
      "price": 42500.50,
      "volume_24h": 28500000000,
      "percent_change_24h": 2.45
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Quick Tips

  • Adjust the limit: Use ?limit=50 to get top 50 cryptos
  • Error handling: Always wrap your fetch in a try-catch for production
  • Rate limits: Check RapidAPI's plan for request limits
  • Cache results: Don't call every second—crypto prices update every 60 seconds anyway

Ready to Build?

This API works great for:

  • Crypto price widgets
  • Trading bots
  • Portfolio apps
  • Educational dashboards

Subscribe on RapidAPI to get your API key and start building. The free tier gives you plenty of requests to test. No complicated authentication—just add your key to the headers and you're live.

Top comments (0)