# OHLC Candles
Returns hourly or daily candles (open, high, low, close) of up to 10 currencies, as JSON or CSV. A candle tells you more than a single rate: where a currency started and ended an hour or a day, and how far it moved in between. Typical uses are candlestick charts, volatility checks and backtests.
Plan required
Like the range (opens new window) endpoint, the OHLC endpoint needs a plan that includes the range
endpoint. Hourly candles also need a plan with quarter-hourly updates or finer, daily candles a plan with hourly updates
or finer. Otherwise requests fail with a 403 status code:
{
"message": "You are not allowed to use the interval: hour, please upgrade your plan",
"info": "For more information, see documentation: https://fxapi.com/docs/status-codes#_403"
}
To lift these limits please upgrade your plan (opens new window).
Request Method: GET
Request URL: https://api.fxapi.com/v1/ohlc
# Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
apikey | string | ️ | Your API Key |
currencies | string | ️ | 1 to 10 comma-separated currency codes (EUR,GBP) The array form currencies[]=EUR¤cies[]=GBP is also accepted |
datetime_start | string | ️ | The start of the range (format: 2026-09-29T00:00:00Z / ISO8601 Datetime, or a date) The first candle is the one this moment falls in |
datetime_end | string | ️ | The end of the range (format: 2026-09-30T23:59:59Z / ISO8601 Datetime, or a date), on or after datetime_startThe last candle is the one this moment falls in |
interval | string | day (default) or hour, the length of each candle. For valid time ranges see below | |
base_currency | string | The base currency to which all results are behaving relative to By default all values are based on USD | |
shape | string | default or compactWith compact every candle is a plain array [datetime, open, high, low, close] | |
precision | integer | Round every value to this many decimals (0 to 10)By default values carry up to 10 decimals | |
format | string | json (default), csv or xlsx. The CSV has one row per candle: datetime,base_currency,currency,open,high,low,closexlsx gives the same table as an Excel workbook, see Excel downloads (opens new window) |
# Valid time ranges
hour: built from the minute rates.datetime_startnot more than 7 days back, not more than 7 days between start and end. Needs a plan with quarter-hourly updates or finer.day: built from the hourly rates.datetime_startnot more than 3 months back, not more than 92 days between start and end. Needs a plan with hourly updates or finer.
Ranges outside these limits return a 422. For daily rates further back, use the
range (opens new window) endpoint.
A request costs one request of your quota, however many currencies and candles it holds. More than 10 currencies
return a 422.
# Sample Request
curl -G https://api.fxapi.com/v1/ohlc \
-d currencies=EUR \
-d interval=hour \
-d datetime_start=2026-09-30T10:00:00Z \
-d datetime_end=2026-09-30T11:59:59Z \
-H "apikey: YOUR-API-KEY"
# Sample Response
data holds the candles of each currency, oldest first. datetime is the start of the hour or day;
meta.datetime_start and meta.datetime_end are the starts of the first and the last candle (the current one when
datetime_end lies in the future).
{
"meta": {
"base_currency": "USD",
"interval": "hour",
"datetime_start": "2026-09-30T10:00:00Z",
"datetime_end": "2026-09-30T11:00:00Z"
},
"data": {
"EUR": [
{
"datetime": "2026-09-30T10:00:00Z",
"open": 0.91,
"high": 0.95,
"low": 0.9,
"close": 0.92
},
{
"datetime": "2026-09-30T11:00:00Z",
"open": 0.92,
"high": 0.925,
"low": 0.9165,
"close": 0.9188
}
]
}
}
# How the candles are built
- Close. Each candle closes on the rate stored at the end of its hour or day, the same rate the range (opens new window) endpoint returns for that hour or day.
- Open. Each candle opens on the close of the candle before it, as FX candles do. The first candle opens on the
close before
datetime_start; after a gap in the data, a candle opens on its own close. - High and low. The extremes of the minute rates (hourly candles) or hourly rates (daily candles) in between. They never lie inside the open/close range, so a candle whose open is below every finer rate has the open as its low.
- Missing candles. Candles whose close is not stored yet, such as the hour or day still running, are left out.
# Compact and CSV
With shape=compact every candle is [datetime, open, high, low, close]:
{
"meta": {
"base_currency": "USD",
"interval": "hour",
"datetime_start": "2026-09-30T10:00:00Z",
"datetime_end": "2026-09-30T11:00:00Z"
},
"data": {
"EUR": [
["2026-09-30T10:00:00Z", 0.91, 0.95, 0.9, 0.92],
["2026-09-30T11:00:00Z", 0.92, 0.925, 0.9165, 0.9188]
]
}
}
With format=csv:
datetime,base_currency,currency,open,high,low,close
2026-09-30T10:00:00Z,USD,EUR,0.91,0.95,0.9,0.92
2026-09-30T11:00:00Z,USD,EUR,0.92,0.925,0.9165,0.9188