How to Get World GDP & Economic Data via API
Free REST API. No API key required for basic access. 337 indicators. JSON responses.
Published April 4, 2026. Examples and limits checked October 11, 2026. Current API reference.
Need GDP data for a project? Population figures for a dashboard? Inflation rates for a research paper? The Statistics of the World API provides 337 economic, demographic, and development indicators, with each reading's year, unit and provider. Basic access requires no authentication and returns JSON. Country and series coverage varies.
Base URL
https://statisticsoftheworld.com/api/v2Python examples use requests; the history example also uses pandas. Install them with python -m pip install requests pandas. The JavaScript example uses the browser Fetch API or a current Node.js release.
1. Get All Data for a Country
Returns the available indicators for one country as an array. Find a reading by its id; each reading carries its own year and unit. Uses ISO 3166-1 alpha-3 country codes (USA, GBR, CHN, etc.).
curl https://statisticsoftheworld.com/api/v2/country/USAimport requests
response = requests.get(
"https://statisticsoftheworld.com/api/v2/country/USA", timeout=30
)
response.raise_for_status()
data = response.json()
by_id = {item["id"]: item for item in data["indicators"]}
# Access GDP
gdp = by_id.get("IMF.NGDPD")
if gdp and gdp["value"] is not None:
print(f"US GDP: {'$'}{gdp['value'] / 1e9:,.1f} billion ({gdp['year']})")
print("Unit:", gdp["unit"], "| Source:", gdp["source"])
# Access population
pop = by_id.get("SP.POP.TOTL")
if pop and pop["value"] is not None:
print(f"US population: {pop['value']:,.0f} ({pop['year']})")const res = await fetch("https://statisticsoftheworld.com/api/v2/country/USA");
if (!res.ok) throw new Error("API request failed: " + res.status);
const data = await res.json();
const gdp = data.indicators.find(item => item.id === "IMF.NGDPD");
const pop = data.indicators.find(item => item.id === "SP.POP.TOTL");
if (gdp?.value != null) {
console.log("US GDP (billion USD):", gdp.value / 1e9, gdp.year);
console.log("Unit:", gdp.unit, "| Source:", gdp.source);
}
if (pop?.value != null) {
console.log("US population:", pop.value, pop.year);
}The API returns this nominal GDP series in current US dollars. The examples divide by one billion for display; population remains in people. Keep the returned year and unit with each value. Current-year IMF readings may be projections, and the response's attribution notice carries source-specific reuse terms.
2. Get Rankings for an Indicator
Returns all countries ranked by a specific indicator. Supports limit and order parameters.
# Top 10 countries by GDP
curl "https://statisticsoftheworld.com/api/v2/indicator/IMF.NGDPD?limit=10&order=desc"
# Bottom 10 by life expectancy
curl "https://statisticsoftheworld.com/api/v2/indicator/SP.DYN.LE00.IN?limit=10&order=asc"import requests
# Get top 10 economies
url = "https://statisticsoftheworld.com/api/v2/indicator/IMF.NGDPD?limit=10&order=desc"
response = requests.get(url, timeout=30)
response.raise_for_status()
top10 = response.json()
for country in top10["data"]:
if country["value"] is not None:
print(f"{country['country']}: {'$'}{country['value'] / 1e9:,.1f}B ({country['year']})")3. Get Historical Time Series
Returns the available history for an indicator and country. IMF series can include projected years as well as earlier estimates. A year label alone does not establish that a reading was observed. Coverage varies by series; missing readings are not zero.
# US GDP history
curl "https://statisticsoftheworld.com/api/v2/history?indicator=IMF.NGDPD&country=USA"
# China inflation history
curl "https://statisticsoftheworld.com/api/v2/history?indicator=IMF.PCPIPCH&country=CHN"import requests
import pandas as pd
url = "https://statisticsoftheworld.com/api/v2/history"
params = {"indicator": "IMF.NGDPD", "country": "USA"}
response = requests.get(url, params=params, timeout=30)
response.raise_for_status()
history = response.json()
# Convert to DataFrame
df = pd.DataFrame(history["data"])
print(df.tail(10)) # Last 10 rows; may include projected yearsCommon Indicator IDs
| Indicator | ID | Source |
|---|---|---|
| GDP (Nominal USD) | IMF.NGDPD | IMF |
| GDP Growth Rate | IMF.NGDP_RPCH | IMF |
| GDP per Capita | IMF.NGDPDPC | IMF |
| Inflation Rate | IMF.PCPIPCH | IMF |
| Unemployment Rate | IMF.LUR | IMF |
| Govt Debt (% GDP) | IMF.GGXWDG_NGDP | IMF |
| Population | SP.POP.TOTL | World Bank |
| Life Expectancy | SP.DYN.LE00.IN | World Bank |
| Fertility Rate | SP.DYN.TFRT.IN | World Bank |
| CO₂ Emissions per Capita | EN.GHG.CO2.PC.CE.AR5 | World Bank |
| Gini Index | SI.POV.GINI | World Bank |
| Internet Users (%) | IT.NET.USER.ZS | World Bank |
Browse the indicator catalog at statisticsoftheworld.com/indicators and read the API reference for current response formats, limits and source terms.
Rate Limits
| Tier | Requests/Day | Auth Required |
|---|---|---|
| Anonymous | 1,000 | No |
| Free (API key) | 1,000 | X-API-Key header |
| Pro | 50,000 | X-API-Key header |
Anonymous limits are counted by IP address. A free key adds usage tracking at the same daily limit. The API reference lists all plans and the rate-limit response headers.
Use Cases
- Dashboards and data visualizations
- Academic research and economics papers
- Journalism and data stories
- AI/ML training data pipelines
- Fintech apps and investment analysis
- Educational tools and classroom exercises
FAQ
Is the API free?
Yes. Basic access permits 1,000 requests/day without a key, counted by IP address. A free key has the same limit and adds usage tracking.
Do I need an API key?
No key is needed for basic access. Free keys add usage tracking; paid plans raise daily limits. See the API reference for current terms.
What format is the response?
All endpoints return JSON. Country codes use ISO 3166-1 alpha-3 (USA, GBR, CHN, etc.).
Where does the data come from?
The catalog includes IMF, World Bank and WHO series. Each response retains source attribution and provider-specific reuse terms.
How often is the data updated?
Timing depends on the provider and series. Retain each reading’s reference year and source; the API reference and methodology explain coverage and update limits.