Air Quality Index
https://data.api.xweather.com/airquality/index/
The air quality index API endpoint provides the current air quality index value for locations globally. This endpoint includes the air quality index (AQI), the associated category, and the standard category color for the requested location.
The AQI value is calculated based on the US AirNow formulas. If other air quality calculations, such as for China, India, Europe, Germany, and the UK, or individual pollutant information is needed please review the Air Quality Endpoint (opens in a new tab), available with the Air Quality Essentials Add-on.
Requests
Every request to the endpoint must include one of the supported actions in the url.
https://data.api.xweather.com/airquality/index/{action}?client_id={client_id}&client_secret={client_secret}&{params}
Supported Actions
The following actions are supported with the /airquality/index endpoint:
Action | Description |
---|---|
:id | Type: stringTypically used for passing a geographical location name or identifier such as city name, lat/long, or even US and Canadian postal codes. Learn more. |
route | Type: stringAllows you to pass several coordinates along a custom route to return data points at each location. Learn more. |
Response
The following is an example of what each object in the response will consist of. Depending on your requested action, the response may contain multiple instances of this object within an array.
Properties
id (string)
The ID of the air quality station. Null if not available.
loc.lat (number)
The latitude coordinate of the record.
loc.long (number)
The place or nearest place to the record.
place.name (string)
The place or nearest place to the record.
place.state (string)
The state abbreviation in which the response is located. This may be null
or an empty string depending on the country.
place.country (string)
The 2 letter ISO-3166 country abbreviation in which the response is located.
periods.#.dateTimeISO (string)
ISO 8601 date of the period.
periods.#.timestamp (number)
UNIX timestamp of the period.
periods.#.aqi (number)
The standardized Air Quality Index value from 0 - 500.
See AirNow
periods.#.category (string)
The Air Quality category based on the AQI:
See AirNow
- good
- moderate
- usg (Unhealthy for Sensitive Groups)
- unhealthy
- very Unhealthy
- hazardous
If using filter=china, the following categories are utilized:
More info on China AQI / Categories.
- excellent
- good
- slightly polluted
- lightly polluted
- moderately polluted
- severely polluted
If using the filter=india, the following categories are utilizes:
More info on India AQI / Categories.
- good
- satisfactory
- moderately polluted
- poor
- very poor
- severe
periods.#.color (string)
The 6 character hexadecimal color code for the specific category.
See AirNow
periods.#.method (string)
The method used for the AQI calculation:
- airnow = Used the EPA AirNow AQI specification (default)
- china = Used the China AQI specification (filter=china)
- india = Used the India AQI specification (filter=india)
profile.tz (string)
Timezone name of the location, such as America/New_York
.
profile.sources.#.name (string)
profile.stations ()
[
{
"id": null,
"loc": {
"lat": 47.38908,
"long": -122.4594
},
"place": {
"name": "burton",
"state": "wa",
"country": "us"
},
"periods": [
{
"dateTimeISO": "2023-12-13T14:00:00-08:00",
"timestamp": 1702504800,
"aqi": 38,
"category": "good",
"color": "00E400",
"method": "airnow"
}
],
"profile": {
"tz": "America/Los_Angeles",
"sources": [
{
"name": "AirNow (EPA)"
},
{
"name": "Washington Department of Ecology"
},
{
"name": "CAMS"
},
{
"name": "Vaisala Xweather"
}
],
"stations": null
}
}
]