International Monetary Fund
IMF Data — Cross-country macro from the IMF's datasets (IFS, WEO, BOP, GFS) on a new SDMX API
When the question is cross-country and macro — reserves, current accounts, government finance, the WEO's growth and inflation projections — and you want the IMF's harmonised numbers rather than thirty national conventions.
Reach for it when…
When the question is cross-country and macro — reserves, current accounts, government finance, the WEO's growth and inflation projections — and you want the IMF's harmonised numbers rather than thirty national conventions.
Not for: High-frequency or market data (IFS is monthly at best), anything time-critical (national sources publish first), automated pulls from the old dataservices.imf.org host, which no longer resolves.
Units, revisions, traps
Units. Depends on the dataset: percent of GDP for fiscal and external balances, index for CPI, national currency or US dollars for levels. WEO values beyond the current year are projections.
Revisions. WEO is re-issued twice a year (April, October) with updates in between; IFS follows national revisions.
- The API moved in 2025 to api.imf.org (SDMX 2.1); old dataservices.imf.org code stops working.
- Dataflow ids changed with the move (e.g. IMF.RES,WEO); check the dataflow list before hard-coding keys.
- Projections are mixed with history in the same series — mark the cut-off year.
Classic mistake: Charting WEO projections as if they were data.
Three recipes
- Recipe 1 · List the available dataflows
- Recipe 2 · A WEO series (browser export, then pandas)
- Recipe 3 · The same reserves series from FRED
Each recipe: Python · Excel · Sheets, with how to read the result. Python recipes run under pandas; recipe 1 is re-run by the weekly check where the source allows it.
How to use it in your own work
Copy the snippet, change the series id, read the result the way the footer says. Replace YOUR_…_KEY with your own key where one is needed.
Recipe 1List the available dataflows
# the new SDMX 2.1 API: what datasets exist
import requests, re
r = requests.get("https://api.imf.org/external/sdmx/2.1/dataflow", headers={"Accept": "application/vnd.sdmx.structure+xml;version=2.1"}, timeout=60)
flows = re.findall(r'<str:Dataflow[^>]*id="([^"]+)"[^>]*agencyID="([^"]+)"', r.text)
print(len(flows), "dataflows"); print(flows[:8])- Browse data.imf.org, open a dataset and use Export (CSV/XLSX).
- Import the export.
Recipe 2A WEO series (browser export, then pandas)
# data.imf.org → World Economic Outlook → pick countries and indicators → Export CSV, then
import pandas as pd
df = pd.read_csv("WEO_export.csv")
print(df.head())- Open the exported file.
- Import the export.
Recipe 3The same reserves series from FRED
# for scripted pulls of an IMF series FRED mirrors, use the FRED id (total reserves ex gold, Korea)
import pandas as pd
u = "https://fred.stlouisfed.org/graph/fredgraph.csv?id=TRESEGKRM052N"
df = pd.read_csv(u, index_col="observation_date", parse_dates=True, na_values=".")
print(df.dropna().tail())- From Web with the FRED URL.
=IMPORTDATA with the FRED URL.Series → question map
The ids we use from IMF Data, each with the question it answers. The catalog's compare view reads the concept tags behind these rows.
| Series | Answers | Region | Concept |
|---|---|---|---|
| WEO · NGDP_RPCH | What does the IMF expect for growth? | global | gdp |
| WEO · PCPIPCH | What does the IMF expect for inflation? | global | cpi |
| IFS · reserves | How large are a country's reserves? | global | reserves |
| BOP · current account | Is a country running a current-account deficit? | global | trade |
Compare with
Same question, different source: World Bank Indicators API, OECD Data Explorer, BIS Data Portal. The compare view lines up coverage, frequency, history and access side by side and lists what the combination makes possible.
Open compare: IMF Data · World Bank Indicators API · OECD Data Explorer →
Questions readers ask
Why does my IMF code return 'name not known'?
The old dataservices.imf.org host was retired. The new API is api.imf.org/external/sdmx/2.1; dataset ids changed.
Is WEO data or forecast?
Both in one series. Each country has a 'estimates start after' year; everything later is a projection.
Do I need a key?
No for the SDMX API at the time of writing; the IMF may add registration for higher limits.
Educational only — we explain, we never advise · snippet licence: public domain · corrections to [email protected], fixed within a day and logged in the changelog.