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.
Code
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
Code
Code
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
| Endpoint | Description |
|---|---|
| GET /v1/cryptocurrency/categories | List all categories with market metrics |
| GET /v1/cryptocurrency/category | Single category details |
| GET /v1/cryptocurrency/listings/historical | Historical listings snapshot |
| GET /v3/cryptocurrency/listings/latest | Current listings with market data |
| GET /v1/cryptocurrency/listings/new | Newly added cryptocurrencies |
| GET /v1/cryptocurrency/map | Map names/symbols to CMC IDs |
| GET /v1/cryptocurrency/trending/gainers-losers | Top gainers and losers |
| GET /v1/cryptocurrency/trending/latest | Currently trending coins |
| GET /v1/cryptocurrency/trending/most-visited | Most visited on CMC |
| GET /v2/cryptocurrency/info | Static metadata (logo, description, URLs) |
| GET /v2/cryptocurrency/market-pairs/latest | Trading pairs for a coin |
| GET /v2/cryptocurrency/ohlcv/historical | Historical OHLCV candles |
| GET /v2/cryptocurrency/ohlcv/latest | Latest OHLCV data |
| GET /v2/cryptocurrency/price-performance-stats/latest | Price performance stats |
| GET /v3/cryptocurrency/quotes/latest | Latest price quotes |
| GET /v3/cryptocurrency/quotes/historical | Historical price quotes |
Common Workflows
Get Token Price by Symbol
Code
Get Top 100 Coins by Market Cap
Code
Get Historical Price Data
Code
Get Token Metadata
Code
Common Use Cases
- Get current price of a token
- Find a token's CMC ID from symbol or name
- Get a token by contract address
- Get top 100 coins by market cap
- Find coins in a price range
- Get historical price at a specific date
- Build a price chart (OHLCV data)
- Find where a coin trades
- Get all-time high and distance from ATH
- Find today's biggest gainers
- Discover newly listed coins
- Get all tokens in a category (e.g., DeFi)
Error Handling
| Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (invalid API key) |
| 403 | Forbidden (endpoint not available on your plan) |
| 429 | Rate limit exceeded |
| 500 | Server 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
/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