FX endpoint
FX spot history
Daily spot history for any pair, to line up each release with how the currency moved.
An active Individual subscription and API key are required for every request.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://api.fxmacrodata.com/v1/forex/eur/usd"
import os
import requests
response = requests.get(
"https://api.fxmacrodata.com/v1/forex/eur/usd",
headers={"X-API-Key": os.environ["FXMACRODATA_API_KEY"]},
timeout=30,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.fxmacrodata.com/v1/forex/eur/usd", {
headers: { "X-API-Key": process.env.FXMACRODATA_API_KEY },
});
const payload = await response.json();
console.log(payload);
What it can do
1 route in this endpoint
Example response
What comes back
A shortened example of the JSON this endpoint returns. Lists are cut to two rows here.
{
"base": "USD",
"quote": "JPY",
"source": "Official central-bank reference rates",
"provenance": {
"publisher": "Official central-bank reference rates",
"storage": "FXMacroData",
"timestamp_field": "date",
"value_field": "val"
},
"pair_metadata": {
"direct_available": true,
"inverse_available": false,
"derived_from_inverse": false,
"derived_from_cross": false,
"derived_from_source_legs": false,
"is_derived": false,
"derivation_method": "direct_original_pair",
"source_pair": "USD/JPY",
"source_legs": [
{
"pair": "USD/JPY",
"source_provider": "BIS XRU",
"source_name": "BIS XRU daily USD exchange rates",
"source_url": "https://stats.bis.org/api/v2/data/dataflow/BIS/WS_XRU/1.0",
"source_frequency": "daily"
}
],
"pair_consistency_check": "passed"
},
"data_quality": {
"source_name": "Official central-bank reference rates",
"source_type": "official",
"is_derived": false,
"datetime_field": "observation_datetime",
"datetime_precision": "date",
"source_legs": [
{
"pair": "USD/JPY",
"source_provider": "BIS XRU",
"source_frequency": "daily"
}
]
},
...
Reference
Parameters and response fields
GET /v1/forex/{base}/{quote} Get FX spot rates
An active Individual subscription and API key are required for every request.
Fetches daily FX spot rates between two currencies using official central-bank reference rates.
Daily reference OHLC:
- On qualifying dates,
data[]also includesopen,high,low, andclosebuilt from timestamped eligible reference observations. These arereference_observation_ohlcbars, not executable-market candles. Rows without at least four observations omit the OHLC fields.
FX source and derivation metadata:
- FX values are official reference rates collected by FXMacroData. USD-quoted pairs are the base series; inverse and cross pairs are derived from those legs when the publisher does not provide the requested pair directly.
- Responses include
pair_metadataand row-leveldata[].sourcewithdirect_available,inverse_available,is_derived,derived_from_inverse,derived_from_cross,derived_from_source_legs,derivation_method,anchor_currency,source_pair,source_legs, andpair_consistency_check. - Upstream FX source priority is BIS XRU daily USD exchange rates where available, then official national-bank daily sources, explicitly labelled EUR/CAD-derived daily crosses, official USD pegs, BIS monthly averages expanded to business days, IMF IFS monthly rates, and World Bank annual rates. Lower-frequency expansions are labelled with
source_frequencyandderivation_method; they are not presented as true daily fixings. data[].observation_datetimeis the UTC midnight timestamp for the FX reference date. It is an observation-date marker, not a publication timestamp.- XAU/USD and USD/XAU use the stored gold series: the National Bank of Ukraine official accounting price of gold divided by the NBU official UAH/USD rate for the same official rate date (Narodowy Bank Polski gold only for dates the NBU did not supply). Source: National Bank of Ukraine (https://bank.gov.ua/en/open-data). No publication clock or LBMA auction price is asserted. The NBU sets each price on the working day before its rate date, so a gold row reflects the market of the day before
date;market_dategives that day. Weekday-label coverage is included.
Parameters
| Name | In | Type | Details |
|---|---|---|---|
| baseRequired | path | string | Base currency code Allowed: 62 currencies. |
| quoteRequired | path | string | Quote currency code Allowed: 62 currencies. |
| start_date | query | string | Start date YYYY-MM-DD |
| end_date | query | string | End date YYYY-MM-DD |
| limit | query | integer | Maximum rows to return. Defaults to 20. Maximum 100. Default: 20. |
| offset | query | integer | Number of rows to skip after most-recent-first ordering. Default: 0. |
| page | query | integer | One-based page number. When supplied, it takes precedence over offset. |
| indicators | query | string | Comma-separated technical indicators to compute (e.g. sma_20,rsi_14,macd,bollinger_bands). Use 'all' to request every supported indicator. |
| dataset_version | query | string | Pin the content version returned by the first page; changed history returns 409. |
| api_key | query | string | Deprecated: legacy query-string API key. Still accepted so existing integrations keep working, but new integrations must send the key in the X-API-Key header (or Authorization: Bearer). A key is required for non-USD, paid-only, or full-history requests. Responses to requests authenticated this way carry a Deprecation header. |
| lang | query | string | Optional language for names and labels, for example es or pt-BR. A regional tag falls back to its base language, and a language that is not yet available returns English with Content-Language: en. Translated fields keep the English text in <field>_original and add a <field>_localized flag. Slugs, field names, codes, dates and values never change. Omit it for English. |
Response fields
| Field | Type | Details |
|---|---|---|
| base | string | |
| quote | string | |
| source | string | |
| provenance | object | |
| provenance.publisher | string | |
| provenance.publisher_url | string | |
| provenance.storage | string | Data provider label for the served series. Always FXMacroData. |
| provenance.served_by | string | FXMacroData endpoint that serves this series. |
| provenance.timestamp_field | string | |
| provenance.value_field | string | |
| pair_metadata | object | Whether the pair is served directly, inverted, or crossed via an anchor. |
| pair_metadata.source_pair | string | |
| pair_metadata.is_derived | boolean | |
| pair_metadata.direct_available | boolean | |
| pair_metadata.inverse_available | boolean | |
| pair_metadata.original_pair_available | boolean | |
| pair_metadata.original_inverse_pair_available | boolean | |
| pair_metadata.derived_from_inverse | boolean | |
| pair_metadata.derived_from_cross | boolean | |
| pair_metadata.derived_from_source_legs | boolean | |
| pair_metadata.derivation_method | string | |
| pair_metadata.anchor_currency | string | |
| pair_metadata.derived_value | integer | |
| pair_metadata.pair_consistency_check | string | |
| pair_metadata.source_note | string | |
| pair_metadata.source_legs[] | object[] | |
| pair_metadata.source_legs[].pair | string | |
| pair_metadata.source_legs[].source_pair | string | |
| pair_metadata.source_legs[].storage_path | string | Retained for compatibility. Always null. |
| pair_metadata.source_legs[].stored_source | string | Retained for compatibility. Always null. |
| pair_metadata.source_legs[].source_provider | string | |
| pair_metadata.source_legs[].source_name | string | |
| pair_metadata.source_legs[].source_url | string | |
| pair_metadata.source_legs[].source_frequency | string | |
| pair_metadata.source_legs[].source_type | string | |
| pair_metadata.source_legs[].is_derived | boolean |
Works well with
Endpoints people use alongside FX spot history
The whole API
All 24 endpoint guides
Rates and markets