Bologna Open Data

Government API · Bologna, Italy · Municipal open data · CKAN

TL;DR

The city of Bologna's open data portal provides municipal datasets via the CKAN API. Browse available datasets, search by keyword, and download data in JSON or CSV format. Topics include transportation (bus routes, bike sharing), environment (air quality, green areas), culture (museums, libraries), demographics, and public services. Part of Italy's open government data initiative. No API key required.

Quick start: https://dati.comune.bologna.it/api/3/action/package_list

No API key needed — open government data!

How to Use This API

1. List All Available Datasets

Returns a JSON array of dataset names (package IDs) available on the portal:

https://dati.comune.bologna.it/api/3/action/package_list

2. Search Datasets by Keyword

Find datasets related to transport (Italian: trasporti):

https://dati.comune.bologna.it/api/3/action/package_search?q=trasporti

3. Get Dataset Metadata

Fetch full metadata for a specific dataset including resources, format, and license:

https://dati.comune.bologna.it/api/3/action/package_show?id=biciclette-pubbliche-bike-sharing

4. JavaScript — Search Italian

const searchTerm = 'biblioteche';
fetch(`https://dati.comune.bologna.it/api/3/action/package_search?q=${searchTerm}`)
  .then(r => r.json())
  .then(data => {
    data.result.results.forEach(ds => {
      console.log(ds.title, '-', ds.resources.length, 'resources');
    });
  });

5. Python — Download a CSV Resource

import requests, csv, io

# Find bike sharing dataset
resp = requests.get(
    'https://dati.comune.bologna.it/api/3/action/package_show'
    '?id=biciclette-pubbliche-bike-sharing'
).json()

# Get first CSV resource
resource = resp['result']['resources'][0]['url']
csv_data = requests.get(resource).text
reader = csv.DictReader(io.StringIO(csv_data))
for row in reader:
    print(row)
Browse all datasets: https://dati.comune.bologna.it/api/3/action/package_list

Frequently Asked Questions

What kind of data does Bologna publish?
Over 200 datasets covering transportation (bus lines, bike sharing), environment (air quality, parks), culture (museums, theaters, libraries), education, demographics, and public services like waste collection and street maintenance.
Is the data available in multiple languages?
Dataset titles and descriptions are primarily in Italian. Some datasets include English metadata. The data values themselves are often numeric or geospatial, making language less of a barrier.
What formats are available?
Datasets are offered in CSV, JSON, GeoJSON, Shapefile, and KML depending on the type of data. Tabular data is typically CSV or JSON; geospatial data is Shapefile or GeoJSON.
How often are datasets updated?
Update frequency varies by dataset: real-time data (like bike stations) updates every few minutes; static datasets (like museum locations) update rarely. Each dataset includes a metadata_modified timestamp.
Is there geospatial data for maps?
Yes — many datasets include GeoJSON or Shapefile formats with coordinates for locations like bus stops, bike stations, parks, and cultural points of interest.
Can I use this commercially?
Yes — Bologna's open data is licensed under CC BY 4.0 International, allowing commercial use with proper attribution to the City of Bologna.

API Details

API URL
https://dati.comune.bologna.it/api/3/action/
Documentation
dati.comune.bologna.it
Category
Government
Authentication
Not Required
License
CC BY 4.0 International

What You Can Build