TL;DR
Eurostat is the statistical office of the European Union, providing free access to a comprehensive range of data covering EU member states, candidate countries, and EFTA nations. The JSON API allows programmatic retrieval of datasets on GDP, population, employment, inflation (HICP), international trade, agriculture, environment, energy, transport, science, and the digital economy. Data is structured using SDMX standards with filters for geography, time period, frequency, and indicators. Responses include full dimension metadata for building dynamic queries.
Quick start: https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/nama_10_gdp?format=JSON
No API key needed — just make a request!
How to Use This API
1. Get GDP Data for EU Countries
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/nama_10_gdp?format=JSON&geo=DE,FR,IT,ES,NL&unit=CP_MEUR
nama_10_gdp is GDP and main aggregates. CP_MEUR = current prices, millions of euros.
2. Get Population Data
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/demo_pjan?format=JSON&geo=DE,FR,IT&time=2023
demo_pjan is population on January 1st by age and sex.
3. Get Harmonised Inflation (HICP)
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/prc_hicp_manr?format=JSON&geo=DE,FR,IT,ES&unit=RCH_A
prc_hicp_manr is HICP monthly rate of change. RCH_A = annual rate of change.
4. Get Unemployment Rate
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/une_rt_a?format=JSON&geo=DE,FR,IT,ES&unit=PC_ACT&sex=T
une_rt_a is unemployment by age and sex. PC_ACT = percentage of active population.
5. Get Employment by Sector
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/nama_10_a10?format=JSON&geo=DE,FR&unit=THS&nace_r2=TOTAL
Employment by 10 NACE industry sectors (manufacturing, services, construction, etc.).
6. Response Format
{
"value": {
"0": 123456.0,
"1": 789012.0
},
"dimension": {
"geo": {"category": {"label": {"DE": "Germany", "FR": "France"}}},
"time": {"category": {"label": {"2023": "2023"}}},
"unit": {"category": {"label": {"CP_MEUR": "Current prices, million euro"}}}
}
}
The value object uses composite index keys. Use the dimension metadata to map indices to dimension values.
7. JavaScript — Fetch and Parse EU GDP
fetch('https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/nama_10_gdp?format=JSON&geo=DE,FR,IT&unit=CP_MEUR')
.then(r => r.json())
.then(d => {
const geoLabels = d.dimension.geo.category.label;
const timeLabels = d.dimension.time.category.label;
const values = d.value;
console.log('GDP data for EU countries:');
Object.entries(values).forEach(([key, val]) => {
console.log(` Observation ${key}: ${val}`);
});
});
8. Python — Query Eurostat
import requests
params = {
'format': 'JSON',
'geo': 'DE,FR,IT,ES',
'unit': 'PC_ACT',
'sex': 'T',
'age': 'TOTAL'
}
resp = requests.get(
'https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/une_rt_a',
params=params
)
data = resp.json()
print("Unemployment rates by country and year:")
for key, val in data['value'].items():
print(f" Index {key}: {val}%")
9. Python — Population Growth Analysis
import requests
resp = requests.get(
'https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/demo_pjan',
params={'format': 'JSON', 'geo': 'DE,FR,IT,NL,SE', 'time': 'all'}
)
data = resp.json()
labels = data['dimension']['time']['category']['label']
geo_labels = data['dimension']['geo']['category']['label']
values = data['value']
print(f"Latest population: {list(geo_labels.values())}")
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/nama_10_gdp?format=JSON&geo=DE,FR,IT&unit=CP_MEUR
Frequently Asked Questions
- How do I find dataset codes for Eurostat?
- Browse the Eurostat database at ec.europa.eu/eurostat/data/database for dataset codes. Common ones:
nama_10_gdp(GDP),demo_pjan(population),une_rt_a(unemployment),prc_hicp_manr(inflation),env_air_gge(greenhouse gas emissions). - What geographic codes are used?
- EU member states use 2-letter NUTS codes (DE, FR, IT, ES, NL, BE, AT, SE, PL, etc.), EU aggregates use EU27_2020, EA20 for Eurozone, EA19 for former Eurozone. Non-EU countries like UK, CH, NO are also available.
- How far back does the historical data go?
- Many datasets start from 1990 or earlier. Use
time=allfor full time series. Some datasets like national accounts go back to 1960. Use thetimeparameter to filter specific years. - What output formats are available?
- JSON (
format=JSON), XML SDMX-ML (format=SDMX), TSV, CSV, and HTML table. JSON is recommended for programmatic access due to its dimension metadata structure. - How do I filter by specific dimensions?
- Eurostat datasets have multiple dimensions like
geo,time,unit,sex,age,nace_r2(industry), etc. The available dimensions vary by dataset. Use?format=JSONwithout filters first to see all dimension options. - Is there a rate limit?
- No specific rate limit documented. Eurostat encourages use but asks to avoid very high-frequency polling. Consider caching data you access regularly.
What You Can Build
- EU economic dashboard comparing GDP, inflation, and unemployment across member states
- Population trend analyzer tracking demographic changes in Europe
- EU trade balance visualizer showing imports/exports between member states
- Environmental tracker using Eurostat emissions and energy data
- Regional analysis tool comparing NUTS-2 regions within and across countries