If your product shows prices in more than one currency, converts payments, or reports revenue earned abroad, it needs exchange rates – and it needs them in a form code can consume. That is the job of an exchange rate API. This explainer answers “what is an exchange rate API?” from a developer’s point of view: how a foreign exchange rates API works on the wire, which kinds of data it serves, how to evaluate one, and what a first request looks like.
An exchange rate API is a web service that returns currency exchange rates as machine-readable data, usually JSON over HTTPS. Your application sends a request naming a base currency, target currencies and optionally a date; the API answers with the rates and a timestamp. Developers use it to price products, convert amounts, translate financial statements and analyze currency trends.
You will also see the terms currency API, forex API, FX rates API and foreign exchange rates API. In everyday use they mean the same thing: reference exchange rates delivered over an HTTP interface.
How an exchange rate API works
Every exchange rate API follows the same request–response pattern as any REST service:
your server exchange rate API
─────────── ─────────────────
GET /v1/latest?base_currency=EUR ──────▶ authenticate API key
header: apikey: **** look up latest dataset
convert to requested base
◀────── 200 OK (JSON body)
cache + use the rates
- Your code builds a request. It picks an endpoint (latest, historical, convert …) and adds query parameters such as the base currency and the list of target currencies.
- It authenticates. Almost every provider issues an API key. With fxapi you send it in the
apikeyHTTP header (recommended) or as anapikeyquery parameter, which is easier to test but may end up in server logs. - The API returns JSON. The response contains the rates and metadata, most importantly the time the data was last updated.
- Your code caches and uses the result. Rates change on a schedule, so a well-built client stores the response and reuses it until the next refresh – see caching exchange rates.
Anatomy of a request
| Part | fxapi example | Purpose |
|---|---|---|
| Base URL | https://api.fxapi.com | Where the API lives (HTTPS only) |
| Endpoint | /v1/latest | Which kind of data you want |
| Auth | apikey: YOUR_API_KEY header | Identifies your account and plan |
base_currency | EUR | The currency all values are relative to (default USD) |
currencies | USD,GBP,JPY | Limit the response to the codes you need |
type | fiat, metal or crypto | Filter by asset class |
Anatomy of a response
{
"meta": { "last_updated_at": "2026-10-08T09:31:00Z" },
"data": {
"USD": { "code": "USD", "value": 1.0924 },
"GBP": { "code": "GBP", "value": 0.8348 },
"JPY": { "code": "JPY", "value": 163.21 }
}
}
Values are illustrative. Read each entry as “1 unit of the base currency buys value units of this currency”: here 1 EUR = 1.0924 USD. If you need the opposite direction, either divide 1 by the value or request a different base – both are explained in base currency and cross rates. Currency keys are ISO 4217 currency codes such as USD and JPY.
Types of exchange rate data
A complete foreign exchange rates API serves more than “today’s rate”. These are the data types you will meet, with the matching fxapi endpoint:
| Data type | Question it answers | fxapi endpoint | Typical use |
|---|---|---|---|
| Latest rates | What is the rate right now? | /v1/latest | Price display, checkout, dashboards |
| Historical rates | What was the rate on a given day? | /v1/historical | Invoices, audits, backfills |
| Time series | How did the rate move over a period? | /v1/range | Charts, analytics, intraday analysis |
| Conversion | How much is 250 GBP in USD? | /v1/convert | Converters, carts, payouts |
| Fluctuation | How much did a rate change between two dates? | /v1/fluctuation | Volatility checks, reporting |
| Averages | What was the average rate for a month or quarter? | /v1/average | Accounting translation (IAS 21 / ASC 830) |
| Metadata | What does this code mean and how is it formatted? | /v1/currencies | Symbols, decimal digits, country mapping |
Latest rates
The core of any real-time exchange rate API. “Real time” for reference data means a frequently refreshed snapshot, not a tick-by-tick stream. With fxapi the snapshot refreshes daily on Free, hourly on Basic and every 60 seconds on Professional and Enterprise.
Historical rates
A historical exchange rates API returns the rate for a specific past date. fxapi’s /v1/historical takes date=YYYY-MM-DD and returns end-of-day values (UTC) back to 1999-01-01. Use it whenever you must reproduce the rate that applied to a past transaction. The difference between end-of-day and live data is covered in end-of-day vs real-time rates.
Time series
Instead of calling the historical endpoint once per day, a time series API returns many data points in one request. fxapi’s /v1/range (Professional and up) supports daily and month-end series back to 1999, week-end series spanning up to 1,830 days per request, and hourly, 15-minute and minute data for recent periods, as JSON or CSV.
Conversion
A currency converter API does the multiplication for you: pass value=250 and get converted amounts back, optionally at a historical date. Doing it yourself with latest rates is equally valid; a convert endpoint simply saves a step.
Fluctuation and averages
Fluctuation returns the start rate, end rate and change between two dates. Averages return the mean rate per month, quarter or year, plus the minimum and maximum. Finance teams use averages to translate income statements – see closing vs average exchange rates and the average exchange rates API.
Where the rates come from
Exchange rates are not set by a single authority. Most currencies float, and their prices form continuously in a decentralized over-the-counter market between banks, brokers and other dealers; some are pegged or managed by a central bank. The Bank for International Settlements estimates average daily FX turnover at $9.6 trillion in April 2025. If you want the economics, read how exchange rates are determined.
In that market every dealer quotes two prices – a bid and an ask. A reference-rate API like fxapi publishes mid-market rates: a neutral benchmark between buying and selling prices, without a bank’s or card network’s markup. That makes it the right number for display, conversion estimates, reporting and analytics. It is not a brokerage feed: there are no executable bid/ask quotes and no order execution. The mid-market rate explainer covers why your bank’s rate differs.
How to evaluate an exchange rate API
Most providers look similar on a landing page. These are the criteria that separate them in production:
| Criterion | What to check | Why it matters |
|---|---|---|
| Update frequency | Daily, hourly, every minute? Per plan? | Stale rates mean wrong prices or unnecessary spread |
| Timestamp | Does every response say when the data was updated? | Needed for audit trails and cache logic |
| Coverage | Number of fiat currencies; metals and crypto included? | Missing one currency can block a market launch |
| History | How far back, and at what granularity? | Backfills, multi-year reports, model training |
| Base currency | Is any base allowed on every plan? | Avoids computing cross rates yourself |
| Data types | Convert, time series, fluctuation, averages? | Fewer requests, less code to maintain |
| Limits | Monthly quota, per-minute limits, overage behavior | Determines your caching strategy |
| Errors | Clear status codes and validation messages? | Faster debugging and safe fallbacks |
| Pricing | Price per request at your volume; can you downgrade? | Total cost over the product’s lifetime |
| Docs and SDKs | OpenAPI spec, SDKs, copy-paste examples | Time to first working integration |
| Legal | Where the company is based, terms of use | Procurement, data protection reviews |
How fxapi answers the checklist:
- Coverage: 190+ currencies – 160 active ISO 4217 fiat currencies, 11 legacy codes kept for history, 4 precious metals and 16 cryptocurrencies. Every code works as
base_currencyand as a target. - History: daily data back to 1999-01-01; intraday granularity for recent periods on Professional and up.
- Updates: daily (Free), hourly (Basic), every 60 seconds (Professional, Enterprise).
- Limits: monthly quotas from 300 to 1,700,000 requests; only successful calls count. The Free plan also has 10 requests per minute; paid plans have no per-minute limit. Exceeding a limit returns HTTP 429.
- Errors: 401 invalid key, 403 endpoint not in plan, 404 no data, 422 validation error with an
errorsobject keyed by parameter, 429 limit reached. - Docs: full API documentation, an OpenAPI file, official SDKs for seven languages and a hosted MCP server for AI agents.
- Pricing: from $0 to $74.99 per month, with custom plans on request – see pricing.
- Company: built by Everapi GmbH in Austria (EU).
Example: your first exchange rate API call
Create a free key at app.fxapi.com/register, then request the latest EUR rates for three currencies:
curl -G "https://api.fxapi.com/v1/latest" \
-d base_currency=EUR \
-d currencies=USD,GBP,JPY \
-H "apikey: $FXAPI_KEY"
The same request in Python with only the requests library, including the error handling a production client needs:
import os
import requests
def latest_rates(base="EUR", symbols=("USD", "GBP", "JPY")):
resp = requests.get(
"https://api.fxapi.com/v1/latest",
params={"base_currency": base, "currencies": ",".join(symbols)},
headers={"apikey": os.environ["FXAPI_KEY"]},
timeout=10,
)
if resp.status_code == 429:
raise RuntimeError("Quota or rate limit reached – serve cached rates")
resp.raise_for_status()
body = resp.json()
rates = {code: item["value"] for code, item in body["data"].items()}
return rates, body["meta"]["last_updated_at"]
rates, updated = latest_rates()
print(f"1 EUR = {rates['USD']} USD (as of {updated})")
To fetch the rate for a past date, switch the path to /v1/historical and add date=2025-12-31. Check how much quota is left at any time with /v1/status, which does not count against it. More languages: JavaScript, PHP, Go (Golang) and the full Python guide.
Common mistakes when integrating an exchange rate API
- Shipping the API key to the browser. Call the API from your backend and expose only the rates your frontend needs.
- Calling the API on every page view. Cache responses for as long as your plan’s update interval; anything more burns quota without fresher data.
- Inverting rounded rates.
1 / 0.92is not the same as the precise inverse of the unrounded rate. Keep full precision and round only the final amount – see currency rounding and precision. - Ignoring the timestamp. Store
last_updated_atwith every converted transaction so you can explain the number later. - Hard-coding currency lists. Codes change: VEF became VES, HRK became EUR. Validate against
/v1/currenciesand read currency code changes. - Using a reference rate as an executable price. Mid-market rates are benchmarks; your payment provider will settle at its own rate.
Summary
An exchange rate API turns a constantly moving market into a predictable JSON response: one HTTPS request, a base currency, a set of target codes and a timestamp. Choose a foreign exchange rates API by update frequency, coverage, history depth, base-currency flexibility, limits and documentation – then cache aggressively and keep full precision. To try it, create a free fxapi key and run the example above, or browse the API docs.
Frequently asked questions
What is an exchange rate API in simple terms?
Is a foreign exchange rates API the same as a forex trading API?
How often do exchange rate APIs update?
meta.last_updated_at, so you always know how fresh the data is.