Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Set COINGECKO_HOST to pro-api.coingecko.com for a paid key; the default api.coingecko.com is the Demo (free) host. Each key is sent only to its own host: the Demo key to api.coingecko.com, the paid key to pro-api.coingecko.com.
- Each successful call spends 1 monthly credit; rate limits depend on the plan.
- Some endpoints and parameters need Analyst plan or above; the Demo plan covers a subset.
- Coin ids are CoinGecko slugs (bitcoin, not BTC); look them up with coingecko.search or coingecko.coins.list.
Endpoints
Get coin prices
- Up to 515 ids per call.
- A symbol lookup returns only the top-ranked coin per symbol unless include_tokens=all.
List coins with market data
- Page with page and per_page; at most 250 ids per call.
Get a coin’s metadata and market data
- The payload is large; turn off localization and tickers to shrink it.
Get a coin’s price history
- Automatic granularity: 5-minute for 1 day, hourly for 2 to 90 days, daily above 90 days.
- Timestamps are epoch milliseconds. Basic plan history is limited to the past 2 years.
Get a coin’s OHLC candles
- Each candle is [close_time_ms, open, high, low, close]. Candle width is automatic: 30 minutes for 1 to 2 days, 4 hours for 3 to 30, 4 days beyond.
Get a coin’s snapshot on a date
- The data is a snapshot at 00:00:00 UTC; the last completed day appears 35 minutes after midnight UTC. Basic plan history is limited to 2 years.
List all coins
- Not paginated; the response holds many thousands of rows.