Every company that buys, sells or owns subsidiaries in another currency needs exchange rates for accounting: a rate for each transaction date, a closing rate for each reporting date and, usually, an average rate for each month. Pulling those numbers by hand from different websites is slow and hard to defend in an audit. fxapi gives finance teams one consistent source of mid-market reference rates for 190+ currencies back to 1999, with endpoints built around the way IAS 21 and ASC 830 use them.
Not accounting advice. This page describes common practice at a high level. The rates you must use depend on your accounting policies, your functional currency and local requirements. Agree your approach with your auditor or accounting advisor.
Which IAS 21 exchange rates you need
IAS 21 The Effects of Changes in Foreign Exchange Rates (IFRS Foundation) and ASC 830 Foreign Currency Matters (FASB) distinguish between rate types. Simplified:
| Situation | IAS 21 (high level) | ASC 830 (high level) | fxapi endpoint |
|---|---|---|---|
| Recording a foreign-currency transaction | Spot rate at the transaction date; an average rate may approximate it | Rate at the transaction date; averages allowed as an approximation | /v1/historical with date |
| Monetary items at period end (receivables, payables, cash) | Closing rate | Current rate at the balance sheet date | /v1/historical with the period-end date |
| Translating a foreign operation – balance sheet | Closing rate | Current rate | /v1/historical |
| Translating a foreign operation – income statement | Transaction-date rates or an average rate | Weighted-average rate as an approximation | /v1/average with period=month |
The difference between the two rate types is explained in closing vs. average exchange rates.
How fxapi supports month-end close
/v1/historicalreturns end-of-day (UTC) rates for any date from 1999-01-01 up to yesterday. Use it for transaction-date rates and for the closing rate on the last day of the period./v1/averagereturns one average per period –month,quarter,yearortotal– for spans up to 1,830 days, withmin,max,daysand asourcelabel in the meta. It costs one request regardless of how many periods it returns. Addformat=csvto get a file that drops into a spreadsheet or consolidation tool./v1/range(Professional and up) returns a full daily series as CSV if you prefer to store every day’s rate yourself.
All three accept any base_currency, so you can request rates directly against your functional or presentation currency – EUR, GBP, CHF or anything else – instead of converting from USD yourself. See the average exchange rates API and historical exchange rates API for full parameter lists.
Month-end close workflow
- Write down the policy. Functional currency per entity, which rate type applies to which line item, and how “closing rate” is defined (fxapi historical values are end-of-day UTC).
- Collect transaction-date rates. A daily job stores
/v1/historicalfor the previous day, or your ERP looks up each invoice date on demand. - Run the close on the first business day of the new month.
/v1/historicaland/v1/averageonly accept dates up to yesterday, so the last day of the month is available from the 1st onward. - Fetch the closing rate with
dateset to the last day of the period. - Fetch the period average with
date_fromanddate_tocovering the month andperiod=month, as CSV. - Check volatility. Compare
minandmaxin the average response; if a currency moved sharply, your policy may require transaction-date rates instead of the average. - Import the rate pack into your ERP, consolidation tool or Excel workbook.
- Archive the evidence – request parameters, raw responses and a hash – next to the close file.
Code example: build a monthly rate pack
The first step in the shell, to see what the CSV looks like:
curl -G "https://api.fxapi.com/v1/average" \
-H "apikey: $FXAPI_KEY" \
-d base_currency=EUR \
-d currencies=USD,GBP,CHF,PLN \
-d date_from=2026-09-01 \
-d date_to=2026-09-30 \
-d period=month \
-d format=csv
The CSV columns are period,date_from,date_to,days,source,base_currency,currency,average,min,max. The Python script below builds a complete pack for the previous month – closing rates plus averages – and stores the raw files with a SHA-256 hash:
import datetime as dt, hashlib, json, os, pathlib, requests
API = "https://api.fxapi.com/v1"
HEADERS = {"apikey": os.environ["FXAPI_KEY"]}
BASE, CURRENCIES = "EUR", "USD,GBP,CHF,PLN"
today = dt.date.today()
last_day = today.replace(day=1) - dt.timedelta(days=1)
first_day = last_day.replace(day=1)
out = pathlib.Path(f"rate-pack/{last_day:%Y-%m}")
out.mkdir(parents=True, exist_ok=True)
def save(name, params, resp):
resp.raise_for_status()
body = resp.content
(out / name).write_bytes(body)
return {"file": name, "params": params, "sha256": hashlib.sha256(body).hexdigest(),
"retrieved_at": dt.datetime.utcnow().isoformat() + "Z"}
closing_params = {"base_currency": BASE, "currencies": CURRENCIES, "date": last_day.isoformat()}
average_params = {"base_currency": BASE, "currencies": CURRENCIES, "period": "month",
"date_from": first_day.isoformat(), "date_to": last_day.isoformat(), "format": "csv"}
manifest = [
save("closing.json", closing_params, requests.get(f"{API}/historical", headers=HEADERS, params=closing_params, timeout=30)),
save("average.csv", average_params, requests.get(f"{API}/average", headers=HEADERS, params=average_params, timeout=30)),
]
(out / "manifest.json").write_text(json.dumps(manifest, indent=2))
Two requests per base currency per month – well inside the Free plan. More patterns in the Python guide.
Building an audit trail
Auditors want to know where a rate came from and that it was not changed afterwards. Keep, for every rate set you use:
- the endpoint and parameters (never the API key),
- the raw response body and
meta.last_updated_atwhere present, - the retrieval timestamp and the user or job that ran it,
- a hash of the stored file, plus the ERP import log.
Storing the evidence yourself means you can reproduce every posted figure independently of any later lookup.
Pitfalls and best practices
- Use one base consistently. Request rates against the entity’s functional currency instead of mixing EUR-based and USD-based tables.
- Respect the “yesterday” rule. Running the close on the last day of the month will fail validation for that day; schedule it for the 1st.
- Keep historical codes. Legacy codes such as HRK, LTL or VEF remain available for history, so restating prior periods still works. Background in currency redenominations and code changes.
- Don’t mix rate types silently. Label every rate as closing, average or spot in your system.
- Document approximations. If you use averages for P&L, keep the
min/maxevidence that rates did not fluctuate significantly.
Close the month with consistent rates
Historical and average rates are on every plan, so you can test the whole workflow on the Free plan today. If you want complete daily series via /v1/range, Professional adds it from $34.99 per month – see pricing. Get a free API key and generate last month’s rate pack in a few minutes.
Everything on this page runs on the fxapi foreign exchange rates API: one key, 190+ currencies, data back to 1999.
Frequently asked questions
Which exchange rate does IAS 21 require?
Can I use a monthly average rate instead of daily rates?
/v1/average returns the average together with the min and max of the period, which helps you document that judgment.How does fxapi calculate the monthly average?
days used, and the first and last periods are clipped to your requested date span.Which fxapi plan do I need for month-end close?
/v1/range is available on Professional and up.