Skip to main content

Set up your API key

Build faster with AI

TL;DR
Use /simple/price for live valuation, /coins/{id}/history for cost basis on purchase dates, /coins/markets for dashboard data, and /coins/{id}/market_chart for performance charts.
Replace YOUR_API_KEY in the examples below with your actual key. Get one here β†’

Portfolio Workflow

1

Set up currency preference β€” /simple/supported_vs_currencies

Fetch all supported fiat and crypto currencies to populate a currency selector in your UI.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/simple/supported_vs_currencies" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Supported Currencies β†’
["btc", "eth", "usd", "eur", "jpy", "gbp", "aud", "cad", "sgd", "myr", ...]
Pass the user’s choice as vs_currencies to pricing endpoints.
2

Live valuation β€” /simple/price

Poll spot prices for all holdings. Batch multiple coins in one call β€” minimal overhead for frequent polling.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana&vs_currencies=usd,eur&include_market_cap=true&include_24hr_change=true" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Simple Price β†’
{
  "bitcoin": {
    "usd": 67432.51,
    "eur": 62145.30,
    "usd_market_cap": 1326789012345,
    "usd_24h_change": 2.34
  }
}
Multiply each price by your holding quantity, then sum for total portfolio value.
3

Token prices by contract β€” /simple/token_price/{id}

For ERC-20 and other contract-based tokens β€” look up prices by contract address instead of coin ID.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/simple/token_price/ethereum?contract_addresses=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x6b175474e89094c44da98b954eedeac495271d0f&vs_currencies=usd&include_market_cap=true" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Simple Token Price β†’
Key paramUse
id (path)Asset platform β€” ethereum, polygon-pos, solana, etc.
contract_addressesComma-separated token addresses
For onchain tokens not listed on CoinGecko, use Onchain Simple Price β€” returns prices by contract address across any supported network.
4

Dashboard data β€” /coins/markets

Rich market data for up to 250 coins per page β€” rankings, sparklines, highs/lows, and multi-timeframe changes.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=bitcoin,ethereum,solana&sparkline=true&price_change_percentage=1h,24h,7d,30d" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Coins Markets β†’
Key paramUse
idsFilter to your portfolio coins only
sparkline7-day sparkline data for inline mini-charts
price_change_percentage1h,24h,7d,30d for multi-timeframe performance
5

Cost basis β€” /coins/{id}/history

Price snapshot on a specific date β€” calculate cost basis for each purchase.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/bitcoin/history?date=15-01-2024" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Coin Historical Data β†’
{
  "market_data": {
    "current_price": {
      "usd": 42856.23,
      "eur": 39456.78
    }
  }
}
The date parameter uses dd-mm-yyyy format (not ISO). Data returned is a snapshot at 00:00:00 UTC.
6

Performance charts β€” /coins/{id}/market_chart

Price, market cap, and volume over time β€” for charting portfolio value and calculating time-weighted returns.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/ethereum/market_chart?vs_currency=usd&days=365&interval=daily" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Coin Market Chart β†’
Key paramUse
daysLookback: 1, 7, 14, 30, 90, 180, 365, or max
intervaldaily for consistent data points, or omit for auto granularity
For tokens tracked by contract address, use Contract Address Market Chart β€” same data, queried by address instead of coin ID.