Population and density API for German cities
A city can have a large population and still be loosely built up. That is why this API returns both: the population figure from Wikidata and the density, computed exactly per city from the 100 metre grid of the 2022 German census. Both values come key-free and always with the year they refer to.
What data you get
One endpoint returns the population with its reference year, plus households, building stock and average rent where reported for the city. A second endpoint returns the population density: the sum of inhabitants across all populated grid cells of the city, the number of those cells, the resulting populated area in square kilometres and the density per square kilometre. The density refers to the populated area, not to the total area of the city.
- Population
- Reference year
- Households (where reported)
- Building stock (where reported)
- Average rent (where reported)
- Population density per square kilometre
- Populated 100 metre cells
- Populated area in square kilometres
- Census reference year
Source: Wikidata (population) and 2022 census, German federal and state statistical offices (density). License:
CC0 1.0 (Wikidata) and DL-DE/BY 2.0 (2022 census). Source, license URL and timestamp are included in every API
response in the meta and attribution block.
How to fetch it
A simple GET request, no key and no sign-up:
curl https://infranode.dev/api/v1/cities/koeln/demographics For another city, just put the slug from the cities list into the path.
No key, no sign-up, free.
Covered cities
All cities in the register. The density is aggregated server-side per official municipality key from the census grid, without a bulk download. Households, buildings and rent are only filled where they are reported, otherwise the field is null.
Available for all 84 covered cities. The exact per-city status is on the coverage and status page, the full list of cities on the cities overview.
Straight to the largest covered cities: Berlin , Hamburg , München , Köln , Frankfurt am Main , Stuttgart , Düsseldorf , Leipzig , Dortmund , Essen .
Endpoint reference
All parameters, fields and response examples are in the API reference for this endpoint. InfraNode is also available as an MCP server for AI assistants.
Frequently asked questions
- Why does the population differ from the census sum?
- They are two different figures. The population is the projected number from Wikidata, the census sum counts inhabitants in populated grid cells as of 2022. Both values carry their reference year in the response, so the difference stays explainable instead of looking like an error.
- Which area is the density based on?
- On the populated area, that is the number of populated 100 metre cells times 0.01 square kilometres. This yields a higher density than using the total area, but it describes the actually settled city. Both intermediate values are included, so any other reference area can be computed.
- Which licence applies to which figure?
- The Wikidata population is CC0 1.0, the census density is DL-DE/BY 2.0 requiring attribution of the German federal and state statistical offices. Every response carries its licence and the binding attribution in a dedicated block.
- Are the values available per district?
- No. The aggregation runs per city via the municipality key. Finer cuts would require a boundary definition the source does not provide.
More data types
- Fuel price API for German cities (MTS-K)
- Car park API for German cities with live occupancy
- Roadworks and closure API for German cities
- Water level API for German cities (PEGELONLINE)
- Weather warning API for German cities (DWD)
- EV charging station API for German cities (BNetzA)
- Weather API for German cities (DWD)
- Air quality API for German cities (UBA)
- Electricity price API for Germany (SMARD)
- Land values API for German cities (BORIS)
- Solar API for German cities (PVGIS)
- Solar cadastre API for German cities (rooftop PV)
- Real-time public transport API for German cities
- Public procurement API for German cities
- Council information API for German cities
- Municipal tax rate API for German cities
- Crime statistics API for German cities (PKS)
- Road accident API for German cities
- Labour market API for German cities
- Business and insolvency API for German cities