placedb

Countries

🇪🇸 Spain 19 administrative divisions

19 first-level administrative divisions (states, provinces, regions or counties, depending on the country) and 67,659 cities and towns, each with latitude and longitude. Public domain, free to download, no API key.

The country

ISO 3166-1
ES · ESP · 724
Capital
Madrid
Continent
Europe
Currency
EUR, euro
Calling code
+34
Internet domain
.es
Divisions
19
Cities and towns
67,659

Divisions

The 19 divisions of Spain

19 of them carry an ISO 3166-2 code. Counts are cities and towns inside each division.

Division ISO 3166-2 Cities and towns Population
Andalusia ES-AN 3,205 8,619,616
Aragon ES-AR 1,594 1,347,834
Asturias ES-AS 4,707 1,008,028
Balearic Islands ES-IB 508 1,176,659
Basque Country ES-PV 1,097 2,230,452
Canary Islands ES-CN 520 2,228,862
Cantabria ES-CB 1,055 591,563
Castile and Leon ES-CL 6,224 2,388,350
CastillaLa Mancha ES-CM 1,579 2,098,853
Catalonia ES-CT 6,758 8,034,743
Ceuta ES-CE 3 83,595
Community of Madrid ES-MD 422 7,001,715
Extremadura ES-EX 607 1,052,790
Galicia ES-GA 36,918 2,703,353
La Rioja ES-RI 292 324,399
Melilla ES-ML 11 86,780
Navarre ES-NC 793 678,338
Region of Murcia ES-MC 320 1,586,989
Valencian Community ES-VC 1,042 5,316,541

A further 4 places could not be matched to a division and are listed separately in the API as "unassigned": true.

Get it

Both files, in one request each

# every division of Spain
curl -s https://api.placedb.org/v1/regions/ES.json

# the cities and towns of one division (id from the file above)
curl -s https://api.placedb.org/v1/cities/ES/<id>.json

No key, no account, no rate limit. The endpoints · try it live.