CoinMarketCapCoinMarketCap
PricingAPI StatusGet API Key
  • Overview
  • API Reference
  • AI Agent Hub
  • Changelog
  • FAQ
If you are an AI agent, LLM, or automated tool, this documentation provides clean Markdown versions of pages. Use the HTTP Link header for the exact Markdown alternate, append .md to documentation page URLs, or start from https://pro.coinmarketcap.com/llms.txt.

© 2026 CoinMarketCap. All rights reserved.

xgithub

Get Historical Price Data with the CoinMarketCap API

Use this workflow when you need historical market data for charts, analytics, or backtesting.

Choose the right endpoint

  • Use GET /v3/cryptocurrency/quotes/historical when you want a historical quote series
  • Use GET /v2/cryptocurrency/ohlcv/historical when you need candlestick data with open, high, low, close, and volume

Historical quotes example

This example fetches the last 7 daily quote points for Bitcoin in USD.

TerminalCode
curl -G 'https://pro-api.coinmarketcap.com/v3/cryptocurrency/quotes/historical' \ --data-urlencode 'id=1' \ --data-urlencode 'count=7' \ --data-urlencode 'interval=daily' \ --data-urlencode 'convert=USD' \ -H 'Accept: application/json' \ -H 'X-CMC_PRO_API_KEY: YOUR_API_KEY'

Use this when you want a time series of quote snapshots. Truncated response:

Code
{ "status": { "timestamp": "2025-01-15T12:00:00.000Z", "error_code": 0, "error_message": null, "elapsed": 15, "credit_count": 1 }, "data": [ { "id": 1, "name": "Bitcoin", "symbol": "BTC", "quotes": [ { "timestamp": "2025-01-08T23:59:59.999Z", "quote": { "USD": { "price": 96800.00, "volume_24h": 28000000000, "market_cap": 1916640000000, "timestamp": "2025-01-08T23:59:59.999Z" } } }, { "timestamp": "2025-01-09T23:59:59.999Z", "quote": { "USD": { "price": 97250.50, "volume_24h": 30500000000, "market_cap": 1925561000000, "timestamp": "2025-01-09T23:59:59.999Z" } } } ] } ] }

OHLCV example

This example fetches 7 daily OHLCV candles for Bitcoin in USD.

TerminalCode
curl -G 'https://pro-api.coinmarketcap.com/v2/cryptocurrency/ohlcv/historical' \ --data-urlencode 'id=1' \ --data-urlencode 'time_period=daily' \ --data-urlencode 'count=7' \ --data-urlencode 'convert=USD' \ -H 'Accept: application/json' \ -H 'X-CMC_PRO_API_KEY: YOUR_API_KEY'

Use this when you need chart-ready candle data with open, high, low, close, and volume. Truncated response:

Code
{ "status": { "timestamp": "2025-01-15T12:00:00.000Z", "error_code": 0, "error_message": null, "elapsed": 18, "credit_count": 1 }, "data": { "id": 1, "name": "Bitcoin", "symbol": "BTC", "quotes": [ { "time_open": "2025-01-08T00:00:00.000Z", "time_close": "2025-01-08T23:59:59.999Z", "time_high": "2025-01-08T14:32:00.000Z", "time_low": "2025-01-08T03:15:00.000Z", "quote": { "USD": { "open": 95800.00, "high": 97200.00, "low": 95100.00, "close": 96800.00, "volume": 28000000000, "timestamp": "2025-01-08T23:59:59.999Z" } } } ] } }

What to choose

  • Choose quotes/historical for historical snapshots and simpler price-series workflows
  • Choose ohlcv/historical for candlestick charts and technical-analysis pipelines

Common mistakes

  • Using OHLCV when all you need is a simpler historical quote series
  • Forgetting to specify count when you are not sending an explicit time window
  • Using symbol in production when id would be more stable

Good next steps

  • Use /v1/cryptocurrency/map if you need to look up stable IDs first
  • Use Get latest crypto prices if you only need the current state
  • Use Choose an endpoint if you want to compare historical paths with other market-data workflows
On this page
  • Choose the right endpoint
  • Historical quotes example
  • OHLCV example
  • What to choose
  • Common mistakes
  • Good next steps
JSON
JSON