Skip to main content
GET
https://api.xchangeapi.com/
{format}
/
chart
/
{currency-pair}
?starttime=
{starttime}
&endtime=
{endtime}
OHLC chart data for date range
curl --request GET \
  --url 'https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}' \
  --header 'api-key: <api-key>'
{
    "1577836800": [
        1.12182,
        1.1221,
        1.12182,
        1.1221,
        1.12169,
        1.12199,
        1.12169,
        1.12199
    ],
    "1577836920": [
        1.12181,
        1.12182,
        1.12181,
        1.12181,
        1.12169,
        1.12169,
        1.12169,
        1.12169
    ],
    "1577836860": [
        1.12181,
        1.12182,
        1.12181,
        1.12181,
        1.12169,
        1.12169,
        1.12169,
        1.12169
    ]
}
Retrieve aggregated chart data (open, high, low, close) for a specific currency pair within a custom time range. This endpoint is ideal for generating historical charts or analyzing market trends over a defined period.
Note on Precision: Some currency pairs are returned with a multiplier (e.g., 100 or 1000) to ensure high precision.

Path parameters

format
string
default:"json"
The desired output format. Options: json, xml, csv.
If you choose xml, you must use the POST method. GET requests for XML will fail.

Query parameters

starttime
string
required
The start of the requested period as a UNIX timestamp (seconds since epoch). Example: 1577836800 (January 1st, 2020).
endtime
string
required
The end of the requested period as a UNIX timestamp (seconds since epoch). Example: 1577836800 (January 1st, 2020).

Response

Response Structure: For a detailed explanation of the array indices (for JSON) and property definitions, please refer to the Response Structures guide.
ask
string
Array of ask prices or aggregated ask data.
bid
string
Array of bid prices or aggregated bid data.
name
string
The currency pair symbol (e.g., EURUSD).
time
string
Array of timestamps corresponding to the data points.
{
    "1577836800": [
        1.12182,
        1.1221,
        1.12182,
        1.1221,
        1.12169,
        1.12199,
        1.12169,
        1.12199
    ],
    "1577836920": [
        1.12181,
        1.12182,
        1.12181,
        1.12181,
        1.12169,
        1.12169,
        1.12169,
        1.12169
    ],
    "1577836860": [
        1.12181,
        1.12182,
        1.12181,
        1.12181,
        1.12169,
        1.12169,
        1.12169,
        1.12169
    ]
}