Browse all documentation

Historical exchange rates API reference

Request stored exchange rates by base, quotes, and date range.

The history operation returns the current accepted stored series in oldest-first order. It uses the same Narwhal key and shared credit as current FX and Economics requests.

Request

REST
curl --request GET \
  --url "https://api.narwhalapi.com/v1/fx/rates/USD/observations?currencies=EUR,NZD&start_date=2026-08-20&end_date=2026-08-28&limit=100" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
ParameterRule
baseUppercase circulating ISO 4217 currency in the path.
currenciesRequired comma-separated list of 1–64 unique quote currencies. The base cannot appear.
start_dateRequired. Inclusive date on or after 1971-01-01.
end_dateRequired. Inclusive date on or after the start and not in the future.
limitObservation dates per page. Default 100; maximum 366.
cursorOpaque value from the previous page. Reuse it only with the same filters.

The MCP tool is fx_get_rate_history. Its currencies input is a JSON array; every other field has the same meaning.

Response

Production-shaped example
{
  "base": "USD",
  "observations": [
    {
      "date": "2026-08-20",
      "rates": [
        { "currency": "EUR", "rate": "0.85609" },
        { "currency": "NZD", "rate": "1.681" }
      ]
    },
    {
      "date": "2026-08-21",
      "rates": [
        { "currency": "EUR", "rate": "0.85477" },
        { "currency": "NZD", "rate": "1.6714" }
      ]
    },
    {
      "date": "2026-08-24",
      "rates": [{ "currency": "EUR", "rate": "0.85734" }]
    }
  ],
  "next_cursor": null
}

Each rate is a decimal string. One unit of base equals the returned amount of currency on that observation date.

start_date and end_date are returned only when Narwhal changes the requested dates.

Pagination

limit counts dates, so a page never splits one date's currency records. When next_cursor is not null, pass it back with the same base, currencies, start date, and end date. The cursor is tied to these filters. Changing them returns 400 invalid_cursor.

There is no overall date-span cap. Full-history backfills use the same bounded page repeatedly until next_cursor is null.

Missing dates and currencies are not fabricated

Only genuine stored observation dates appear. Weekends, holidays, and other missing publication dates are omitted. Narwhal does not forward-fill them.

A date can contain only a subset of the requested currencies. In the example, NZD has no record on August 24 while EUR does. That is a truthful sparse observation, not a partial-response error.

Price bars

GET /v1/fx/rates/{base}/bars returns closed bars with open, high, low and close for one currency pair. MCP tool: fx_get_rate_bars.

REST
curl --request GET \
  --url "https://api.narwhalapi.com/v1/fx/rates/USD/bars?currency=EUR&interval=1h&start=2026-10-08T00:00:00Z&end=2026-10-08T03:00:00Z" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
ParameterRule
baseThe currency one unit of which is priced, for example USD or EUR. A pair we cannot serve returns 404 currency_not_supported.
currencyThe currency the price is in, such as JPY.
interval1m, 5m, 15m, 1h, 4h or 1d (default).
start / endBoth required. UTC times on interval boundaries (4h at 00, 04, 08 and so on; 1d at midnight). Start is inclusive; end is exclusive.
limit / cursorDefault 100, at most 500. Reuse next_cursor with the same query.
functionOptional. One technical indicator to add to each daily bar: sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar or stochrsi. Needs interval=1d.
periodOptional settings of the indicator, with the names and defaults of the stock technicals route: period, fast_period, slow_period, signal_period, fast_kperiod, slow_kperiod, slow_dperiod, fast_dperiod, acceleration and maximum. Each needs function.

Each bar has timestamp (bar start) and open, high, low and close in units of currency per one base. We never fill gaps: missing bars stay missing. We keep 1m and 5m bars for 30 days and 15m, 1h, 4h and 1d bars indefinitely. A range outside retention returns an empty bars list, not an error.

start and end are returned only when Narwhal changes the requested range.

A request may span at most 3 days of 1m bars, 14 days of 5m bars, 60 days of 15m bars; a longer range returns 400 invalid_query. Wider intervals have no cap.

Cross pairs

A pair we hold no bars for, with USD on neither side, such as EUR and JPY, is computed from the two currencies' bars against USD. Each bar has timestamp and close only: the close of currency divided by the close of base, both against USD, to 6 significant digits. A time that either currency has no bar for is left out.

REST
curl --request GET \
  --url "https://api.narwhalapi.com/v1/fx/rates/EUR/bars?currency=JPY&interval=1d&start=2026-11-18T00:00:00Z&end=2026-11-20T00:00:00Z" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
200 OK
{
  "base": "EUR",
  "currency": "JPY",
  "bars": [
    { "timestamp": "2026-11-18T00:00:00Z", "close": "174.906" },
    { "timestamp": "2026-11-19T00:00:00Z", "close": "175.193" }
  ],
  "next_cursor": null
}

Indicators on daily bars

With function, each bar carries indicator and the answer carries indicator_parameters: the function, the settings used and methodology_url. We compute each value from every daily bar up to that bar, with the formulas of the stock technicals route. Bars before the function has enough history have no indicator.

A computed cross pair has no high or low, so atr, stochastic, adx, dmi, cci and sar answer 400 invalid_query for it. A pair with too few daily bars for the function answers 404 not_covered.

Errors

  • 400 invalid_query for invalid currencies, dates, or page size.
  • 400 invalid_cursor for malformed or filter-mismatched pagination state.
  • 401 invalid_api_key for a missing or invalid Bearer key.
  • 404 currency_not_supported when the selected currency is unavailable.
  • 404 not_found A computed cross pair with no bar in the range asked for. The call is not charged.
  • 404 not_covered A pair with too few daily bars for the indicator asked for.
  • 429 rate_limit_exceeded when the short-window limit is reached; wait for Retry-After before retrying.
  • 402 insufficient_credits when your balance does not cover the call.
  • 503 upstream_unavailable when the accepted historical data cannot be read safely.

See the errors and limits guide for both rate-limit header families and retry behavior.

Coverage and limits

Coverage begins at different dates by currency. The earliest supported stored series begins in 1971; most daily coverage begins in 1999 or 2000. Coverage can expand without changing this contract.

This Interface returns the current accepted historical series, not every earlier publication vintage. It omits source, provider, licence, derivation, staleness, and market-session fields. Read the FX methodology for the public data policy and the FX product page for all live operations.

Was this page helpful?