An updated database of italian CAP and Nomenclature of Territorial Units for Statistics

Italian "regioni", "province", municipality data, zip codes and Istat Codes always in sync in your application with this brand new APIs

  • Author: Simone Desantis
  • //
  • Date: 10/09/2020
  • //
  • Reading time: 3 min

Every year for administrative and demografic reasons, italians public administation use to make little adjustments on his "N.U.T.S." structures. Some time the municipalities structure change too. Some time a municipality is assigned to an another province, some other the change is made on the ZIP code or, as is called in Italy CAP (codice avviamento postale), to fit the new structures or in reply to a postal specific organizing need. For example in 2020 6 merge of municipalities are made for a total abolition of 14 municipalities and 1 new municipality is born called "Borgo d'Anaunia". The same year, on may, only in province of Milano (MI) 40 changes on ZIP codes are made and other affected cities are Bari, Cagliari, Catania, Cesena, Firenze, Livorno, Messina, Milano, Palermo, Parma, Pescara, Reggio Calabria, Rimini, Roma e Trento.

Changes mades allows users to a grace period of 6 months but after that a letter sent to an old zip code or to a non more existent municipality will not be delivered.

Since there isn't a real open data available for this issue, we have createde the new "Comuni Italiani" service: https://console.openapi.com/apis/cap/documentation

Is a super fast service that allow you to query by Province, Region, Istat Code, CAP and obtain a detailed structure of italian municipalities theire and relative zip code associated.

Its use is easy as it seems.

Assuming you are looking for all the municipalities under a specific CAP (05100 for example), you can query the service in a single GET call (once you obtained your bearer token) to https://cap.openapi.it/cap/05100 and you will get a response as follows:

{
"dati": {
"nome_provincia": "Terni",
"sigla_provincia": "TR",
"regione": "Umbria",
"comuni": [
"Terni"
],
"dettaglio_comuni": [
{
"nome": "Terni",
"popolazione": 109193,
"codice_catastale": "L117"
}
]
},
"successo": vero,
"messaggio": "",
"errore": nullo
}

 

As you can see additional data are reported like "population" and "codice catastale" (aka codice ISTAT).

But there's more. There are several types of communal data verification and updating services made available by Openapi. Here is a complete list:

  • Cerca Comuni (GET /cerca_comuni) to obtain the ISTAT code of any Italian city
  • Cerca Comuni Base (GET /comuni_base/{istat_code}) to obtain, from the ISTAT code, the basic information of a city such as region, province, postcode
  • Cerca Comuni Advance (GET /comuni_advance/{istat_code}) to discover, again from the ISTAT code, more detailed information about a city (e.g. area code, tax code, area, number of residents etc.)
  • Cerca CAP  (GET /cap/{cap}) to obtain, starting from the postcode, the following corresponding data: ISTAT code, municipality, hamlet (if any), province, province abbreviation, region
  • Cerca Comuni Soppressi (GET /comuni_soppressi) to access the list of suppressed municipalities in a given province and information such as ISTAT code, Tax Code, Region, province name in an extended manner
  • Cerca Città Metropolitane (GET /comuni_metropolitane) to get the list of all metropolitan cities with information such as population, area, density, number of municipalities
  • Cerca Regioni (GET /regioni) to obtain the list of all regions with information such as capital city number, residents, number of municipalities, president, tax code, PEC, site, location
  • Cerca Province (GET /province) to get the list of all provinces with information such as acronym, area, residents, number of municipalities and istat codes
  • Cerca Province (GET /province/{code} which provides information such as acronym, surface area, residents, number of municipalities and istat codes for a given province

The methods provinces, regions, suppressed municipalities and metropolitan municipalities provide 10,000 calls/month free of charge.

The best use of this simple but effective technology is in e-commerce integrations, autocomplete, address list data remediation, postalization and every time you want to update the geografical database structure of your application.

Try to think if a company owning several e-commerce have to deal with a simple ZIP code change.
Clients are calling because their order never arrived, meetings with a developer is scheduled, several application must be updated, swarms of possible bugs rise on the horizon!

This will not be your problem, because you understood the importance of delegating just in time and your applications are always in sync and automagically updated.

An updated database of italian CAP and Nomenclature of Territorial Units for Statistics

Share on: