Historical FX rate by date

$0.002 per call · USDC via x402 · GET /api/fx-historical

Historical foreign-exchange rate for a specific date using European Central Bank reference rates (via Frankfurter). Send GET /api/fx-historical with the required fields from, to and date and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with from, to, date, rate and source.

Returns the rate that was published on (or rolled forward to) the requested date. ?from=USD&to=EUR&date=2024-01-02

Category: Live public data · Tags: forex fx currency historical exchange-rate ecb macro

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
fromstringyes3-letter source currency code, e.g. USD Also accepted as source, src, start.
tostringyes3-letter target currency code, e.g. EUR Also accepted as target, dest, destination, end.
datestringyesISO date (YYYY-MM-DD)

Example request

curl -i "https://agent402.tools/api/fx-historical?from=USD&to=EUR&date=2024-01-02"

Without payment this returns HTTP 402 Payment Required with the exact price for fx-historical; any x402 v2 or MPP client pays it and retries.

Example response

{
  "from": "USD",
  "to": "EUR",
  "date": "2024-01-02",
  "rate": 0.9128,
  "source": "ECB via Frankfurter"
}
FieldTypeAlways presentIn the example
fromstringyesUSD
tostringyesEUR
datestringyes2024-01-02
ratenumberyes0.9128
sourcestringyesECB via Frankfurter

From an MCP client

catalog.call {
  "slug": "fx-historical",
  "params": {
    "from": "USD",
    "to": "EUR",
    "date": "2024-01-02"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for fx-historical; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/fx-historical?from=USD&to=EUR&date=2024-01-02");

Part of these workflows

Historical FX rate by date is one step in this skill pack, each sold as a single call:

Related tools

FX rate time series

$0.005 · GET /api/fx-timeseries

Daily FX rates between two currencies across a date window using European Central Bank reference rates (via Frankfurter)…

Currency exchange rate

$0.002 · GET /api/fx-rate

Live currency conversion using European Central Bank reference rates (via Frankfurter). Converts an amount between two c…

G10 FX dashboard vs USD

$0.005 · GET /api/fx-dashboard

Snapshot of all G10 spot exchange rates quoted against USD (EUR, GBP, JPY, CHF, CAD, AUD, NZD, SEK, NOK) using ECB refer…

Country info

FREE w/ compute · or $0.001 · GET /api/country-info

Country facts by name or ISO code: official name, capital, region, currencies, languages, timezones, dialing code, TLD, …

US CPI year-over-year inflation

$0.005 · GET /api/cpi-yoy

Latest US Consumer Price Index year-over-year inflation rate (headline CPI-U) plus the trailing 12 months of YoY reading…

Crypto global market

$0.008 · GET /api/crypto-global

Global crypto market snapshot: total market cap, total 24h volume, BTC dominance, ETH dominance, active coin count, acti…