Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Retrieve IMF economic indicators, exchange rates, and country data
.claude/skills/brycewang-stanford-imf-data-api-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 45% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 43% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 66% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 52% | 0% |
The International Monetary Fund (IMF) provides a free JSON-based REST API for accessing its extensive collection of macroeconomic and financial datasets. The API covers data from virtually every country and territory, spanning indicators such as GDP, inflation, trade balances, exchange rates, government finance statistics, and balance of payments.
For economics researchers, the IMF API is an essential tool for accessing authoritative international economic data without manual downloads. The data powers research in macroeconomics, development economics, international finance, and policy analysis. The API provides access to key datasets including the World Economic Outlook (WEO), International Financial Statistics (IFS), Balance of Payments Statistics (BOP), and the Direction of Trade Statistics (DOTS).
The API requires no authentication and returns JSON data. It uses a hierarchical structure of datasets, indicators, and country/time dimensions.
No authentication is required. The IMF Data API is completely free and open.
bash# No API key needed curl "https://www.imf.org/external/datamapper/api/v1/NGDP_RPCH?periods=2024"
GET https://www.imf.org/external/datamapper/api/v1bashcurl -s "https://www.imf.org/external/datamapper/api/v1" | python3 -m json.tool
GET https://www.imf.org/external/datamapper/api/v1/indicatorsGET https://www.imf.org/external/datamapper/api/v1/{indicator}?periods={year}Common Indicators:
NGDP_RPCH: Real GDP growth (annual percent change)PCPIPCH: Inflation, consumer prices (annual percent change)BCA_NGDPD: Current account balance (percent of GDP)GGXWDG_NGDP: Government gross debt (percent of GDP)LUR: Unemployment rateExample: Get real GDP growth for all countries in 2024:
bashcurl -s "https://www.imf.org/external/datamapper/api/v1/NGDP_RPCH?periods=2024" \ | python3 -m json.tool
For more granular data, use the Dataflow-based API:
GET http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/{database}/{dimensions}?startPeriod={start}&endPeriod={end}Example: Monthly CPI data for the US and China:
bashcurl -s "http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/IFS/M.US+CN.PCPI_IX?startPeriod=2020&endPeriod=2025" \ | python3 -m json.tool
pythonimport requests DATAMAPPER_URL = "https://www.imf.org/external/datamapper/api/v1" def get_indicator_data(indicator, periods=None): """Fetch IMF indicator data for all countries.""" url = f"{DATAMAPPER_URL}/{indicator}" params = {} if periods: params["periods"] = ",".join(str(p) for p in periods) resp = requests.get(url, params=params) resp.raise_for_status() return resp.json() # Compare real GDP growth across G7 countries data = get_indicator_data("NGDP_RPCH", periods=[2022, 2023, 2024]) values = data.get("values", {}).get("NGDP_RPCH", {}) g7_codes = ["USA", "GBR", "FRA", "DEU", "JPN", "CAN", "ITA"] print("Country | 2022 | 2023 | 2024") print("--------|--------|--------|-------") for code in g7_codes: country_data = values.get(code, {}) row = f"{code:7s}" for year in ["2022", "2023", "2024"]: val = country_data.get(year, "N/A") if isinstance(val, (int, float)): row += f" | {val:5.1f}%" else: row += f" | {str(val):>6s}" print(row)
pythonimport requests def get_exchange_rates(country_codes, start_year, end_year): """Fetch exchange rate data from IFS database.""" codes = "+".join(country_codes) url = ( f"http://dataservices.imf.org/REST/SDMX_JSON.svc/" f"CompactData/IFS/A.{codes}.ENDA_XDC_USD_RATE" f"?startPeriod={start_year}&endPeriod={end_year}" ) resp = requests.get(url) resp.raise_for_status() return resp.json() data = get_exchange_rates(["BR", "IN", "ZA"], 2015, 2024) series = data.get("CompactData", {}).get("DataSet", {}).get("Series", []) for s in series: country = s.get("@REF_AREA", "Unknown") obs = s.get("Obs", []) if isinstance(obs, dict): obs = [obs] print(f"\n{country} exchange rate (LCU per USD):") for o in obs: print(f" {o.get('@TIME_PERIOD')}: {o.get('@OBS_VALUE')}")
Cross-Country Panel Analysis: Retrieve indicator data for multiple countries and years to construct panel datasets for econometric analysis. Combine GDP growth, inflation, and trade data for gravity models or growth regressions.
Policy Impact Assessment: Track economic indicators before and after major policy changes or economic shocks. Compare indicator trajectories across treatment and control country groups.
Forecasting Benchmarks: Use IMF WEO projections as baseline forecasts to compare against model predictions. The IMF publishes projections for most indicators several years forward.
Development Economics: Access poverty, inequality, and structural indicators for developing economies to study convergence, aid effectiveness, and institutional quality.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 19,340 | 12,154 | -37% | 1 | 1 | 0% | 3,652 | 4,269 | +17% | 0 | 0 | — |
case-02 | fail→pass | 22,230 | 16,326 | -27% | 1 | 1 | 0% | 3,434 | 4,988 | +45% | 0 | 0 | — |
case-03 | pass→pass | 10,742 | 9,245 | -14% | 1 | 1 | 0% | 1,900 | 3,650 | +92% | 0 | 0 | — |
case-04 | pass→pass | 9,805 | 7,264 | -26% | 1 | 1 | 0% | 1,796 | 3,118 | +74% | 0 | 0 | — |
case-05 | pass→pass | 16,433 | 12,418 | -24% | 1 | 1 | 0% | 2,854 | 3,980 | +39% | 0 | 0 | — |
case-06 | pass→pass | 7,814 | 3,522 | -55% | 1 | 1 | 0% | 1,307 | 2,465 | +89% | 0 | 0 | — |
case-07 | pass→pass | 6,679 | 3,146 | -53% | 1 | 1 | 0% | 1,185 | 2,379 | +101% | 0 | 0 | — |
case-08 | pass→pass | 4,974 | 2,747 | -45% | 1 | 1 | 0% | 861 | 2,279 | +165% | 0 | 0 | — |
case-09 | pass→pass | 5,575 | 3,161 | -43% | 1 | 1 | 0% | 1,049 | 2,350 | +124% | 0 | 0 | — |
case-10 | fail→pass | 16,538 | 14,314 | -13% | 1 | 1 | 0% | 3,282 | 4,685 | +43% | 0 | 0 | — |
case-11 | pass→pass | 10,703 | 4,953 | -54% | 1 | 1 | 0% | 1,818 | 2,825 | +55% | 0 | 0 | — |
case-12 | pass→pass | 7,496 | 5,188 | -31% | 1 | 1 | 0% | 1,311 | 2,871 | +119% | 0 | 0 | — |
case-13 | pass→pass | 10,571 | 7,482 | -29% | 1 | 1 | 0% | 2,063 | 3,153 | +53% | 0 | 0 | — |
case-14 | pass→pass | 13,224 | 7,164 | -46% | 1 | 1 | 0% | 2,179 | 3,029 | +39% | 0 | 0 | — |
case-15 | pass→pass | 7,899 | 2,174 | -72% | 1 | 1 | 0% | 996 | 2,082 | +109% | 0 | 0 | — |
case-16 | pass→pass | 19,019 | 12,003 | -37% | 1 | 1 | 0% | 2,940 | 3,830 | +30% | 0 | 0 | — |
case-17 | fail→pass | 17,541 | 13,564 | -23% | 1 | 1 | 0% | 2,552 | 4,231 | +66% | 0 | 0 | — |
case-18 | pass→pass | 4,918 | 2,330 | -53% | 1 | 1 | 0% | 818 | 2,180 | +167% | 0 | 0 | — |
case-19 | fail→pass | 8,893 | 2,627 | -70% | 1 | 1 | 0% | 1,427 | 2,168 | +52% | 0 | 0 | — |
case-20 | pass→pass | 5,304 | 2,605 | -51% | 1 | 1 | 0% | 913 | 2,256 | +147% | 0 | 0 | — |
case-21 | pass→pass | 6,885 | 3,902 | -43% | 1 | 1 | 0% | 1,021 | 2,445 | +139% | 0 | 0 | — |
case-22 | fail→pass | 13,149 | 3,966 | -70% | 1 | 1 | 0% | 2,119 | 2,512 | +19% | 0 | 0 | — |
case-23 | pass→pass | 5,922 | 3,276 | -45% | 1 | 1 | 0% | 786 | 2,297 | +192% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +26 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.