Get coin OHLCV
Get OHLCV (Open High Low Close Volume) data for the coin throughout time.
https://api.coinranking.com/v2/coin/:uuid/ohlcv
Preview access
Free, Basic and Startup plans can test this endpoint with five successful requests per account per UTC day. Use the documented endpoint URL with your existing API key. Preview access is applied automatically. The allowance resets at 00:00 UTC.
All API keys, resource IDs, query parameters and pagination requests share this endpoint's allowance for your account. Failed requests do not consume the preview allowance. Successful previews also count toward your normal API usage, and your plan's result, historical-window and rate limits still apply. See endpoint previews for limits, response headers and quota errors.
This endpoint has two modes:
- Latest candles (default): without a
fromparameter, the endpoint returns the most recentlimitcandles for the chosen interval — the classic behaviour. - Historical window: supply a
from(and optionalto) timestamp to fetch a specific time range instead. Minute-resolution history is available all the way back to December 2018, so you can pull deep historical candlestick data and page through arbitrarily long ranges.
Path parameters
| Parameter | Description |
|---|---|
uuid String | UUID of the coin you want to request the OHLCV data for. |
Query parameters
| Parameter | Description |
|---|---|
interval (optional) String | The interval determines the time period over which each OHLC item is determined. Default value: dayAllowed values: minute 5minutes hour 8hours day week month Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?interval=hour
|
limit (optional) Number | Limit. Limit the amount of time periods for which the OHLCV data is retrieved. For example, when interval=hour and limit is 10, data will be returned for the last 10 hours. Production access requires the Growth plan or higher. Free previews are limited to 100 results per response. All other plans can receive up to 5000 results per response, including previews. Ignored in historical window mode (when Size range: 0-5000 Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?limit=10
|
from (optional) Number | Start of the historical window as a Unix timestamp in seconds. Supplying Minute-resolution history is available back to December 2018. When omitted, the endpoint stays in the default latest-candles mode. Size range: 0-4102444800Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?interval=hour&from=1614556800&to=1617235200
|
to (optional) Number | End of the historical window as a Unix timestamp in seconds. The window is half-open: candles are returned for every interval bucket that starts before Size range: 0-4102444800 Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?interval=hour&from=1614556800&to=1617235200
|
referenceCurrencyUuid (optional) String | UUID of coin (either fiat or crypto), in which all the prices are calculated. Defaults to US Dollar, but you can use any coin. You can find UUIDs for reference currencies in any coin endpoint, including a convenient dedicated reference currency endpoint Note: When using a reference currency, the OHLC values are converted from USD-based calculations rather than recalculated from raw trading data. Since reference currency exchange rates fluctuate during the time period this means:
Example:
https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?referenceCurrencyUuid=5k-_VTxqtCEI
|
Fetching historical ranges
Supplying a from timestamp puts the endpoint in historical window mode. It returns the candles that fall inside the half-open range [from, to) for the chosen interval, ordered newest-first, with minute-resolution data available back to December 2018.
The 1440-candle cap and paging
A single response returns at most 1440 candles. When the response does not cover the whole requested window, it is truncated to the portion nearest from and a continuation cursor is returned on data.paging.next (a Unix timestamp in seconds). To fetch the next page, repeat the request with from set to that value and the same to. When the window has been returned in full, data.paging.next is null.
Always drive paging from data.paging.next, not from the candle count. A page can contain fewer than 1440 candles and still have more to follow — a non-null next always means there is another page. Keep requesting until next is null.
Walking a range this way is gapless and overlap-free, and identical requests always return identical candles. Historical windows are immutable and returned with a long cache lifetime (Cache-Control: max-age=3600; recent windows use max-age=60), so responses can be cached aggressively.
# 1) Request a wide range
GET /v2/coin/Qwsogvtv82FCd/ohlcv?interval=minute&from=1609459200&to=1612137600
# 2) Response was truncated, e.g. data.paging.next = 1609545600
# Fetch the next page by advancing `from` to that value:
GET /v2/coin/Qwsogvtv82FCd/ohlcv?interval=minute&from=1609545600&to=1612137600
# 3) Keep going until data.paging.next is null Data availability in historical candles
avgisnullthroughout deep history — it is not reconstructable from the archived data.- For older periods where only the closing price was preserved,
open,highandloware derived from the close, so those candles are flat (all four equal). They arenullonly for buckets that have no data at all (wherecloseisnulltoo). intervalVolumeisnullfor periods where the source did not record interval volume.24hVolumein a historical candle is the rolling 24-hour volume recorded at the end of that bucket — a point-in-time snapshot, never a sum of the interval.
Intervals and access
All intervals (minute through month) can be queried with from/to. Production access requires the Growth plan or higher. Free, Basic and Startup plans can use preview access within their plan’s historical window. Historical requests are subject to a daily fair-use quota, and exceeding it returns a 429 response (see Error response).
Code examples
curl 'https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?referenceCurrencyUuid=5k-_VTxqtCEI&interval=hour&limit=50' \
-H 'x-access-token: your-api-key' \
-G const options = {
headers: {
'x-access-token': 'your-api-key',
},
};
fetch('https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?referenceCurrencyUuid=5k-_VTxqtCEI&interval=hour&limit=50', options)
.then((response) => response.json())
.then((result) => console.log(result)); <?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?referenceCurrencyUuid=5k-_VTxqtCEI&interval=hour&limit=50",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-access-token: your-api-key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response; import requests
headers = {
'x-access-token': 'your-api-key'
}
response = requests.request("GET", "https://api.coinranking.com/v2/coin/Qwsogvtv82FCd/ohlcv?referenceCurrencyUuid=5k-_VTxqtCEI&interval=hour&limit=50", headers=headers)
print(response.text) Response
HTTP/1.1 200 OK
{
"status": "success",
"data": {
"ohlc": [
{
"startingAt": 1733011200,
"endingAt": 1735689600,
"open": "96447.1775503152",
"high": "108201.88415847138",
"low": "91546.14889956331",
"close": "92757.25601337428",
"avg": "98498.05461116068",
"24hVolume": "46442676990.360725",
"intervalVolume": "2002368626068.8618"
},
{
"startingAt": 1730419200,
"endingAt": 1733011200,
"open": "70322.96990325804",
"high": "99588.89995964085",
"low": "66922.19464691161",
"close": "96449.1102387863",
"avg": "86276.37524878597",
"24hVolume": "38017759048.21358",
"intervalVolume": "3928981914099.0195"
}
]
}
} In historical window mode (when from is supplied), the response additionally includes a data.paging object holding the continuation cursor:
HTTP/1.1 200 OK
{
"status": "success",
"data": {
"ohlc": [
{
"startingAt": 1609545540,
"endingAt": 1609545600,
"open": "29280.11",
"high": "29342.57",
"low": "29271.04",
"close": "29331.86",
"avg": null,
"24hVolume": "51477880123.44",
"intervalVolume": null
}
],
"paging": {
"next": 1609545600
}
}
} Response fields
| Property | Description |
|---|---|
status String | Status of the request Allowed values:success |
data Object | |
data.ohlc Object[] | List of OHLC items |
data.ohlc.startingAt Number | An Epoch timestamp in seconds marking the start of the time period on which the OHLC values are based. |
data.ohlc.endingAt Number | An Epoch timestamp in seconds marking the end of the time period (exclusive). |
data.ohlc.open String/null | Opening price of the coin for the time period in the reference currency |
data.ohlc.high String/null | Highest USD price of the coin during the time period in the reference currency. When using non-USD reference currencies, the highest USD price is directly converted to the reference currency. Since the reference currency itself can fluctuate against the US Dollar, the High is not necessarily the highest price in the chosen reference currency. |
data.ohlc.low String/null | Lowest USD price of the coin during the time period in the reference currency. When using non-USD reference currencies, the lowest USD price is directly converted to the reference currency. Since the reference currency itself can fluctuate against the US Dollar, the Low is not necessarily the lowest price in the chosen reference currency. |
data.ohlc.close String/null | Closing price of the coin for the time period in the reference currency |
data.ohlc.avg String/null | Average price of the coin over the time period. Always |
data.ohlc.24hVolume String/null | Total 24h volume of the coin in the reference currency. In historical candles this is a rolling 24-hour snapshot taken at the end of the bucket, not a sum of the interval. |
data.ohlc.intervalVolume String/null | Total volume of the coin for the specified time interval in the reference currency. In the default latest-candles mode this is populated for the week and month intervals only. In historical window mode it is also populated for finer intervals where the data source recorded interval volume; otherwise it is |
data.paging Object | Only present in historical window mode (when |
data.paging.next Number/null | Epoch timestamp in seconds to use as the next |
Error response
HTTP/1.1 404 Not Found
{
"status": "fail",
"type": "COIN_NOT_FOUND",
"message": "Coin not found"
} Error responses
| Error | Description |
|---|---|
FORBIDDEN Object | Returned by the gateway in the code field when endpoint access is denied. Production access requires the Growth plan or higher. Free, Basic and Startup plans can use preview access. Read the identifier defensively as body.type || body.code. Upgrade your plan. |
| Error | Description |
|---|---|
COIN_NOT_FOUND Object | The coin could not be found. Try another UUID |
| Error | Description |
|---|---|
VALIDATION_ERROR Object | The request could not be validated. The response should provide more details. For window mode, common causes are to without from, or to not greater than from. |
REFERENCE_UNAVAILABLE Object | The reference currency used in the request is not available. Choose another UUID. |
| Error | Description |
|---|---|
TOO_MANY_REQUESTS Object | The daily fair-use quota for deep-history requests has been reached, or too many history requests are in flight at once. Slow down and retry, or contact support. |