Ciencia ciudadana por la calidad del aire · Colombia

How to query and download data with the AireCiudadano interface

The AireCiudadano open API lets anyone download the measurements of the whole network, either as hourly averages or as raw minute-by-minute readings.

1. Access the web interface

The web interface at sensor.aireciudadano.com:8081/getdata offers a simple form to choose the parameters and fetch the results. The /getdata path serves the form that lets you configure and download your query.

2. Configure the query

Variables to select. You can pick one or more of the following: PM25, PM25raw, PM1, Humidity and Temperature.

Start and end date and time. The maximum range per query is three months, limited by the CPU and RAM of the server. If you need more, split the request into several parts.

Station filter (optional). A keyword to limit the results to specific stations, separated by commas. For example station1,station2 or sta,aire.

Result format. “Result in screen” shows the result on screen, for a maximum of seven days. “Result in json ZIP file” or “Result in csv ZIP file” downloads a ZIP archive with the data; CSV files are considerably smaller.

3. What the results look like

On screen, the result is a JSON document with the hourly averages (each one the mean of 60 minute-by-minute samples) of every station that reported during the selected period.

Each record contains the date and time, and the value of every variable you selected:

{
  "total_records": 120,
  "data": {
    "station1": [
      {
        "date": "2024-01-01T01:00:00Z",
        "PM25": 12.5,
        "Temperature": 23.6
      }
    ]
  }
}

4. A few things to keep in mind

  • A query for one day and one variable can take about two minutes and produce around 7,000 records. A query for three months and five variables can take an hour and a half and produce 385,000 records.
  • Because the API is heavy on CPU and RAM, only one query is processed at a time. New requests queue up while one is running.
  • Hourly averages are cumulative, following the same approach as the official stations: the 03:00 average covers 02:00:01 to 03:00:00, about 60 minute-by-minute samples.