Skip to content
FX fundamentals

What is an exchange rate API?

A plain-English, developer-focused explainer: how a foreign exchange rates API works, which data types it serves, and the checklist to use before you pick one.

Last updated: · fxapi team

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
  1. 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.
  2. It authenticates. Almost every provider issues an API key. With fxapi you send it in the apikey HTTP header (recommended) or as an apikey query parameter, which is easier to test but may end up in server logs.
  3. The API returns JSON. The response contains the rates and metadata, most importantly the time the data was last updated.
  4. 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

Partfxapi examplePurpose
Base URLhttps://api.fxapi.comWhere the API lives (HTTPS only)
Endpoint/v1/latestWhich kind of data you want
Authapikey: YOUR_API_KEY headerIdentifies your account and plan
base_currencyEURThe currency all values are relative to (default USD)
currenciesUSD,GBP,JPYLimit the response to the codes you need
typefiat, metal or cryptoFilter 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 typeQuestion it answersfxapi endpointTypical use
Latest ratesWhat is the rate right now?/v1/latestPrice display, checkout, dashboards
Historical ratesWhat was the rate on a given day?/v1/historicalInvoices, audits, backfills
Time seriesHow did the rate move over a period?/v1/rangeCharts, analytics, intraday analysis
ConversionHow much is 250 GBP in USD?/v1/convertConverters, carts, payouts
FluctuationHow much did a rate change between two dates?/v1/fluctuationVolatility checks, reporting
AveragesWhat was the average rate for a month or quarter?/v1/averageAccounting translation (IAS 21 / ASC 830)
MetadataWhat does this code mean and how is it formatted?/v1/currenciesSymbols, 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:

CriterionWhat to checkWhy it matters
Update frequencyDaily, hourly, every minute? Per plan?Stale rates mean wrong prices or unnecessary spread
TimestampDoes every response say when the data was updated?Needed for audit trails and cache logic
CoverageNumber of fiat currencies; metals and crypto included?Missing one currency can block a market launch
HistoryHow far back, and at what granularity?Backfills, multi-year reports, model training
Base currencyIs any base allowed on every plan?Avoids computing cross rates yourself
Data typesConvert, time series, fluctuation, averages?Fewer requests, less code to maintain
LimitsMonthly quota, per-minute limits, overage behaviorDetermines your caching strategy
ErrorsClear status codes and validation messages?Faster debugging and safe fallbacks
PricingPrice per request at your volume; can you downgrade?Total cost over the product’s lifetime
Docs and SDKsOpenAPI spec, SDKs, copy-paste examplesTime to first working integration
LegalWhere the company is based, terms of useProcurement, 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_currency and 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 errors object 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.92 is 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_at with 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/currencies and 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?
It is a web service your code calls over HTTPS to get currency exchange rates as structured data, usually JSON. You send a request with the currencies you care about and receive current or historical rates you can use for pricing, conversion or reporting.
Is a foreign exchange rates API the same as a forex trading API?
No. A foreign exchange rates API like fxapi returns mid-market reference rates for display, conversion, accounting and analytics. A trading API streams executable bid/ask quotes and places orders with a broker. See mid-market rate for the difference.
How often do exchange rate APIs update?
It depends on the provider and the plan. fxapi refreshes daily on Free, hourly on Basic and every 60 seconds on Professional and Enterprise. Every response includes meta.last_updated_at, so you always know how fresh the data is.
Can I use an exchange rate API for free?
Yes. fxapi’s Free plan includes 300 requests per month with daily updates, historical data back to 1999, fluctuation and average endpoints. See the free exchange rate API page for details.
Which programming languages can call an exchange rate API?
Any language that can make an HTTPS request and parse JSON. fxapi has official SDKs for JavaScript, Python, PHP, Go, Ruby, C# and Rust, and step-by-step integration guides for each.
Free plan · no credit card

Get your free exchange rate API key

300 requests a month, latest and historical rates, fluctuation and averages – free forever. Upgrade when you need faster updates or more requests.