waqi

Query real-time and forecast air quality (AQI) data from the World Air Quality Index project (WAQI/AQICN). Use when checking air quality, PM2.5, pollution levels, or AQI for any city or coordinates worldwide. Supports city name lookup, geo-coordinate queries, station search, and multi-day PM2.5/PM10/O3 forecasts. Also known as aqicn.org.

Install:

Requires curl and WAQI_API_TOKEN environment variable.

Documentation

WAQI — World Air Quality Index API

Query air quality data from https://waqi.info (website: https://aqicn.org). WAQI and AQICN are the same project — WAQI is the API name, AQICN is the website.

Setup

API token is in env var WAQI_API_TOKEN.

TOKEN="$WAQI_API_TOKEN"

API Endpoints

Base URL: https://api.waqi.info

All requests append ?token=$TOKEN.

1. City Feed (by name)

curl -s "https://api.waqi.info/feed/{city}/?token=$WAQI_API_TOKEN"

Examples: feed/beijing/, feed/tokyo/, feed/shanghai/

2. Geo Feed (by coordinates)

curl -s "https://api.waqi.info/feed/geo:{lat};{lng}/?token=$WAQI_API_TOKEN"

Returns the nearest monitoring station to the given coordinates.

curl -s "https://api.waqi.info/search/?keyword={query}&token=$WAQI_API_TOKEN"

Returns matching stations with current AQI. Use to find station names or discover monitoring coverage.

4. Map Stations (bounding box)

curl -s "https://api.waqi.info/v2/map/bounds/?latlng={lat1},{lng1},{lat2},{lng2}&networks=all&token=$WAQI_API_TOKEN"

Returns all stations within a bounding box. Useful for comparing AQI across a region.

Response Structure

Key fields in a feed response (.data):

AQI Scale (US EPA)

AQILevelColor
0-50Good🟢
51-100Moderate🟡
101-150Unhealthy for Sensitive Groups🟠
151-200Unhealthy🔴
201-300Very Unhealthy🟣
301+Hazardous🟤

Tips

for coords in "39.90;116.40" "40.97;115.27" "36.65;116.98"; do
  curl -s "https://api.waqi.info/feed/geo:${coords}/?token=$WAQI_API_TOKEN" | \
    jq -r '[.data.aqi, .data.city.name] | @tsv'
done

View source on GitHub →