Economic indicator series
Yearly values of a World Bank indicator for up to 30 countries, regions or income groups: GDP, GDP per capita and growth, inflation, unemployment, population, trade, FDI, debt, reserves, interest and exchange rates, CO2, poverty, Gini and ~1,500 more (friendly names like gdp or inflation, or any indicator code). A year range or the most recent N values; each series with its latest value.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
indicatorrequired | string | Indicator code (e.g. NY.GDP.MKTP.CD) or name: gdp, gdp_per_capita, gdp_growth, gdp_ppp, gni_per_capita, inflation, unemployment, population, population_growth, life_expectancy, exports, imports, trade_pct_gdp, fdi, debt_pct_gdp, current_account, reserves, interest_rate, real_interest_rate, exchange_rate, co2_per_capita, electricity_access, internet_users, literacy, poverty, gini, urban_population, military_spending, health_spending, education_spending. Example: gdp |
country | string | ISO-2/ISO-3 codes or aggregates (WLD, EUU, HIC...), comma-separated, or all (default WLD). Example: US,CN,DE |
start_year | integer | First year (default 20 years ago). Example: 2015 |
end_year | integer | Last year (default this year). |
most_recent | integer | Instead of years: the N most recent non-empty values. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/econ/v1/series?indicator=gdp" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/econ/v1/series",
params={"indicator": "gdp"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/econ/v1/series");
url.searchParams.set("indicator", "gdp");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).