CoinMarketCapCoinMarketCap
PricingAPI StatusGet API Key
  • Overview
  • API Reference
  • WebSocket
  • 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://coinmarketcap.com/llms.txt.

© 2026 CoinMarketCap. All rights reserved.

xgithub
AI Integrations
    CoinMarketCap AI Agent HubChat Completionsx402MCPCMC CLI
IDE Setup
    CursorClaude CodeWindsurf
Skills
    CoinMarketCap AI Agent Skills
    MCP Skills
    x402 Skills
    API Integration Skills
      Cryptocurrency APIDEX APIExchange APIMarket API
    CLI Skills
API Integration Skills

Cryptocurrency API

GitHub repo: coinmarketcap-official/skills-for-ai-agents-by-CoinMarketCap

REST API endpoints for retrieving price data, market listings, historical quotes, trending coins, and token metadata.

Authentication

All requests require an API key in the header.

TerminalCode
curl -X GET "https://pro-api.coinmarketcap.com/v3/cryptocurrency/listings/latest" \ -H "X-CMC_PRO_API_KEY: your-api-key"

Get your API key at https://pro.coinmarketcap.com/login

Base URL: https://pro-api.coinmarketcap.com

Writing code: use the official SDKs

When you want a script, an app or an integration rather than a one-off lookup, the skill tells your agent to write it with the official SDKs instead of raw HTTP or a third-party wrapper: @coinmarketcap/sdk (npm install @coinmarketcap/sdk), coinmarketcap-sdk (pip install coinmarketcap-sdk) and the Go SDK (go get github.com/OpenCMC/coinmarketcap-api-go/v5).

Code
import { CoinMarketCap } from "@coinmarketcap/sdk"; const cmc = new CoinMarketCap({ apiKey: process.env.CMC_PRO_API_KEY }); const { data, error } = await cmc.api.cryptocurrency.quotesLatest({ query: { id: "1,1027" }, });
Code
import os from coinmarketcap import CoinMarketCap cmc = CoinMarketCap(api_key=os.environ["CMC_PRO_API_KEY"]) quotes = cmc.cryptocurrency.quotes_latest(id="1,1027")
Code
import ( "context" "log" "os" "github.com/OpenCMC/coinmarketcap-api-go/v5" ) cmc, err := coinmarketcap.New(coinmarketcap.WithAPIKey(os.Getenv("CMC_PRO_API_KEY"))) if err != nil { log.Fatal(err) } quotes, err := cmc.Cryptocurrency.QuotesLatest(context.Background(), &coinmarketcap.CryptocurrencyQuotesLatestParams{ ID: coinmarketcap.String("1,1027"), }) if err != nil { log.Fatal(err) }

The skill's references/sdk.md lists the SDK method for every endpoint below and which ones also work without an API key.

API Overview

EndpointDescription
GET /v1/cryptocurrency/categoriesList all categories with market metrics
GET /v1/cryptocurrency/categorySingle category details
GET /v1/cryptocurrency/listings/historicalHistorical listings snapshot
GET /v3/cryptocurrency/listings/latestCurrent listings with market data
GET /v1/cryptocurrency/listings/newNewly added cryptocurrencies
GET /v1/cryptocurrency/mapMap names/symbols to CMC IDs
GET /v1/cryptocurrency/trending/gainers-losersTop gainers and losers
GET /v1/cryptocurrency/trending/latestCurrently trending coins
GET /v1/cryptocurrency/trending/most-visitedMost visited on CMC
GET /v2/cryptocurrency/infoStatic metadata (logo, description, URLs)
GET /v2/cryptocurrency/market-pairs/latestTrading pairs for a coin
GET /v2/cryptocurrency/ohlcv/historicalHistorical OHLCV candles
GET /v2/cryptocurrency/ohlcv/latestLatest OHLCV data
GET /v2/cryptocurrency/price-performance-stats/latestPrice performance stats
GET /v3/cryptocurrency/quotes/latestLatest price quotes
GET /v3/cryptocurrency/quotes/historicalHistorical price quotes

Common Workflows

Get Token Price by Symbol

TerminalCode
# Step 1: Get CMC ID for ETH curl -X GET "https://pro-api.coinmarketcap.com/v1/cryptocurrency/map?symbol=ETH" \ -H "X-CMC_PRO_API_KEY: your-api-key" # Step 2: Get price quote (using id=1027 for ETH) curl -X GET "https://pro-api.coinmarketcap.com/v3/cryptocurrency/quotes/latest?id=1027" \ -H "X-CMC_PRO_API_KEY: your-api-key"

Get Top 100 Coins by Market Cap

TerminalCode
curl -X GET "https://pro-api.coinmarketcap.com/v3/cryptocurrency/listings/latest?limit=100&sort=market_cap" \ -H "X-CMC_PRO_API_KEY: your-api-key"

Get Historical Price Data

TerminalCode
curl -X GET "https://pro-api.coinmarketcap.com/v3/cryptocurrency/quotes/historical?id=1&time_start=2024-01-01&time_end=2024-01-31&interval=daily" \ -H "X-CMC_PRO_API_KEY: your-api-key"

Get Token Metadata

TerminalCode
curl -X GET "https://pro-api.coinmarketcap.com/v2/cryptocurrency/info?id=1,1027" \ -H "X-CMC_PRO_API_KEY: your-api-key"

Common Use Cases

  1. Get current price of a token
  2. Find a token's CMC ID from symbol or name
  3. Get a token by contract address
  4. Get top 100 coins by market cap
  5. Find coins in a price range
  6. Get historical price at a specific date
  7. Build a price chart (OHLCV data)
  8. Find where a coin trades
  9. Get all-time high and distance from ATH
  10. Find today's biggest gainers
  11. Discover newly listed coins
  12. Get all tokens in a category (e.g., DeFi)

Error Handling

CodeMeaning
200Success
400Bad request (invalid parameters)
401Unauthorized (invalid API key)
403Forbidden (endpoint not available on your plan)
429Rate limit exceeded
500Server error

Response Format

Every response has a status object and the result in data. The v1 and v2 endpoints return error_code as a number and error_message as null:

Code
{ "status": { "timestamp": "2024-01-15T12:00:00.000Z", "error_code": 0, "error_message": null, "credit_count": 1 }, "data": { ... } }

/v3/cryptocurrency/listings/latest and /v3/cryptocurrency/quotes/latest return error_code as a string ("0" on success) and error_message as an empty string, so compare error_code as a string or convert it first. Their data is an array, and each coin's quote is an array with one item per convert currency:

Code
{ "status": { "timestamp": "2026-10-27T13:21:19.524Z", "error_code": "0", "error_message": "", "elapsed": 4, "credit_count": 1 }, "data": [ { "id": 1, "name": "Bitcoin", "symbol": "BTC", "slug": "bitcoin", ... "quote": [ { "id": 2781, "symbol": "USD", "price": 80135.34564293954, "market_cap": 1611067273199.0273, "percent_change_24h": 0.12770083, ... "last_updated": "2026-10-27T13:20:00.000Z" } ] } ] }
CMC x402Cryptocurrency API
On this page
  • Authentication
  • Writing code: use the official SDKs
  • API Overview
  • Common Workflows
    • Get Token Price by Symbol
    • Get Top 100 Coins by Market Cap
    • Get Historical Price Data
    • Get Token Metadata
  • Common Use Cases
  • Error Handling
  • Response Format
TypeScript
Go
JSON
JSON