Skip to main content
GET
/
coins
/
{id}
/
ohlc
Coin OHLC Chart by ID
curl --request GET \
  --url https://api.coingecko.com/api/v3/coins/{id}/ohlc \
  --header 'x-cg-demo-api-key: <api-key>'
[
  [
    1779199200000,
    76769,
    76889,
    76744,
    76818
  ],
  [
    1779201000000,
    76712,
    76712,
    76321,
    76422
  ]
]

Notes

  • Find a coin’s API ID on its CoinGecko page, via Coins List, or this Google Sheet.
  • The timestamp in the response indicates the close time of each OHLC candle.
  • Auto-granularity (candle body):
    • 1–2 days: 30 minutes
    • 3–30 days: 4 hours
    • 31 days and beyond: 4 days
  • For better granularity, consider Coin Historical Chart Data.
The last completed UTC day (00:00) is available 35 minutes after midnight (00:35 UTC).
Historical data via the Demo API is restricted to the past 365 days. Subscribe to a paid plan for the full range.

SDK Examples

const response = await client.coins.ohlc.get('bitcoin', {
  vs_currency: 'usd',
  days: '1',
});

console.log(JSON.stringify(response, null, 2));

Authorizations

x-cg-demo-api-key
string
header
required

Path Parameters

id
string
default:bitcoin
required

Coin ID. *refers to /coins/list.

Query Parameters

vs_currency
string
default:usd
required

Target currency of price data. *refers to /simple/supported_vs_currencies.

days
enum<string>
default:1
required

Data up to number of days ago.

Available options:
1,
7,
14,
30,
90,
180,
365
precision
enum<string>

Decimal place for currency price value.

Available options:
full,
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18

Response

200 - application/json

Coin OHLC chart data