Endpoint: airquality

The air quality API endpoint provides current information for locations globally. The observed air quality will be interpolated data or specific station observation data depending on the query action. This endpoint includes the air quality index (AQI), category, dominant pollutant, and information for a variety of pollutants when available.

Check out our Air Quality Release Blog for additional information.

Use our wizard to try out this endpoint

Supported Actions

The following actions are supported with the airquality endpoint:

:id Requesting data by using the :id action is used for returning data for a particular item that has an ID associated with it. This is the primary method for requesting general weather information for a single location (observations, forecasts, advisories, etc.) as the location's name or a zip code serves as the id. Other endpoints may expect a certain value for the ID, such as storm cells whose ID value is a combination of the radar site identifier and unique identifier assigned to every storm cell. Refer to an endpoint's detailed documentation for specific information regarding how to use the :id action.
closest The closest action will query the API for data that is closest to the requested place and return the results, if any, in order from closest to farthest. If no limit is provided in the request, then only the closest single result will be returned.

If your request does not return results, you may try setting or increasing the radius being used.
within The within action allows for returning data within a variety of different geometrical regions. Currently supported geometries include a circle (requires a center point and radius), rectangle (requires two coordinate points defining the top-left and bottom-right corners) and polygon (requires at least three coordinate points). Unlike the closest action, the results will not be returned in any particular order based on distance.
search The search action is used as a more general query method and expects the query to be defined with the custom query for the request. Unlike the closest action, results will not be returned in any particular order.
route The route action returns data for points along a given route. This can be useful to obtain weather information along a transportation route, trails and more. The route is a series of locations, usually latitude/longitudes provided via the p query parameter or for longer routes via GeoJSON within a POST request. The route will return an array of GeoJSON points with the requested data for each point.

Supported Parameters

The following parameters are optional unless otherwise noted:

p p=:place Defines the location to query data for. Refer to the list of supported place value formats.
filter filter=:string Predefined filters for limiting the results. The filter value can be a single, comma-delimited or a semicolon delimited string of filter names.
query query=:string Used to filter results based on certain fields in the data set. See Advanced Queries for more details.
limit limit=:total The total number of results to return as an integer. Each endpoint may have a set maximum for this value depending on usage.

The default limit is 1 if not specified. The maximum limit for this endpoint is 250.
skip skip=:number Used to skip over a specific number of results in the data set.
sort sort=:string Used to sort results based on certain fields in the data set. See Sorting for more details.
fields fields=:string Provides a comma separated list of values for the API to return. This parameter is often used to limit the amount of data returned. See Reducing Output.
format format=:string Defines the API output format. The available options include:
format=json - Standard JSON output. This is the default.
format=geojson - API will output GeoJSON.

If obtaining GeoJSON and using the fields parameter, be sure to include loc to ensure geographical references are available in the response.
plimit plimit=:total Applied only on the periods property, the total number of periods to return as an integer. The maximum plimit for this endpoint is 250.
pskip pskip=:number Applied only on the periods property, used to skip over a specific number of periods in the data set.
psort psort=:string Applied only on the periods property, used to sort results based on certain fields contained within the periods.
radius radius=:distance:unit When requesting the closest results within a circle, the radius determines how far from the specified location to search. A valid unit value must be included in your radius value, e.g., "5mi", "10km", "25miles". If no unit is provided, your value is assumed to be in meters by default.

Most endpoints utilize a default radius of 50 miles, though some endpoints, such as lightning, may have tighter restrictions specified.
minradius minradius=:distance:unit When requesting the closest results within a circle, the minradius determines how far from the specified location to search to begin searching results. A valid unit value must be included in your minimum radius value, e.g., "5mi", "10km", or "25miles". If no unit is provided, your value is assumed to be in meters by default.
When combined with the radius parameter, donut style queries can be made for point data, such as lightning.
mindist mindist=:distance:unit When using the route action, mindist determines the minimum distance along the route to return the requested data for. A valid unit value must be included in your mindist value, e.g. "5mi", "10km", "50miles". If no unit is provided, your value is assumed to be in meters by default.

The default minimum distance between route data is 5 miles if not specified.

Supported Filters

The following filters can be passed to the filter parameter to reduce the results that are returned:

pm2p5 Filters based on observations that include a pm2.5 measurement
pm10 Filters based on observations that include a pm10 measurement
no2 Filters based on observations that include a nitrogen dioxide measurement
co Filters based on observations that include a carbon monoxide measurement
so2 Filters based on observations that include a sulfur dioxide measurement
o3 Filters based on observations that include a ozone measurement
china Utilize the Chinese Government AQI categories, in place of the default AirNOW categories

For more information on various Air Quality Index standards, please visit the wiki page.
india Utilize the India AQI categories, in place of the default AirNOW categories

For more information on various Air Quality Index standards, please visit the wiki page.

Supported Query Properties

Use the following supported property keys when creating custom queries for your requests:

pm2p5 Query based on the pm2.5 value in ug/m3
pm10 Query based on the pm10 value in ug/m3
no2 Query based on the Nitrogen dioxide in ug/m3
co Query based on the Carbon Monoxide in ug/m3
so2 Query based on the Sulfur dioxide in ug/m3
o3 Query based on the ozone in ug/m3
dt Query based on the observation date/time
id Query based on the station ID
name Query based on the observation station name.
city Query based on the observation station city
state Query based on the two letter state abbreviation the observation station resides in.
country Query based on the two letter country abbreviation the observation station resides in.

Sortable Fields

You can use the following fields to sort data. Review the sorting docs page for more information on the sort functionality.

pm2p5 Used with the psort parameter. Sort based on the pm2.5 value
pm10 Used with the psort parameter. Sort based on the pm10 value
no2 Used with the psort parameter. Sort based on the no2 value
co Used with the psort parameter. Sort based on the co value
so2 Used with the psort parameter. Sort based on the so2 value
o3 Used with the psort parameter. Sort based on the o3 value
dt Used with the psort parameter. Sort based on the observation date/time
id Used with the sort parameter. Sort based on the observation station ID
name Used with the sort parameter. Sort based on the observation station name
city Used with the sort parameter. Sort based on the observation station's city
state Used with the sort parameter. Sort based on the observations stations two letter state abbreviation
country Used with the sort parameter. Sort based on the observations stations two letter country abbreviation

Examples

The /[:endpoint]/[:action]? portion within the query template below can be exchanged with any of the examples. Also, please note you will need to input your client credentials in the [ID] and [SECRET] fields which can be found under the Apps section of the members area.

https://api.aerisapi.com/[:endpoint]/[:action]?client_id=[ID]&client_secret=[SECRET]

Returns the estimated air quality information for Beijing, China
/airquality/beijing,cn?

Returns the estimated air quality information for zip code 55403 (Minneapolis, MN)
/airquality/55403?

Returns the estimated air quality information for the specified latitude, longitude.
/airquality/44.9778,-93.265?

Returns the latest air quality observation for station ID AQCN_1004. Air Quality station IDs always begin with "AQ"
/airquality/AQCN_1004a?

Returns the estimated air quality information for Beijing, China using the China defines air quality categories.
/airquality/beijing,cn?filter=china&

Returns up to 10 closest air quality observations to Beijing, China
/airquality/closest?p=beijing,cn&limit=10&

Returns up to 100 air quality observations within 100 miles of Beijing, China. Note: Unlike the closest action, the within action does NOT sort the results based on distance.
/airquality/within?p=beijing,cn&radius=100miles&limit=100&

Returns 10 latest observations within china with the highest pm2.5 values, sorted descending.
/airquality/search/?query=country:cn&sort=pm2p5:-1&limit=10&

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.

Default
GeoJSON

{
    "success": true,
    "error": null,
    "response": [{
        "id": null,
        "loc": {
            "lat": 39.9042,
            "long": 116.4074
        },
        "place": {
            "name": "beijing",
            "state": "bj",
            "country": "cn"
        },
        "periods": [{
            "dateTimeISO": "2018-05-30T06:00:00+08:00",
            "timestamp": 1527631200,
            "aqi": 69,
            "category": "moderate",
            "color": "FFFF00",
            "method": "airnow",
            "dominant": "o3",
            "pollutants": [{
                "type": "o3",
                "name": "ozone",
                "valuePPB": 61,
                "valueUGM3": 122.3333,
                "aqi": 69,
                "category": "moderate",
                "color": "FFFF00",
                "method": "airnow"
            }, {
                "type": "pm2.5",
                "name": "particle matter (<2.5µm)",
                "valuePPB": null,
                "valueUGM3": 14.6,
                "aqi": 56,
                "category": "moderate",
                "color": "FFFF00",
                "method": "airnow"
            }, {
                "type": "pm10",
                "name": "particle matter (<10µm)",
                "valuePPB": null,
                "valueUGM3": 36.7778,
                "aqi": 33,
                "category": "good",
                "color": "00E400",
                "method": "airnow"
            }, {
                "type": "co",
                "name": "carbon monoxide",
                "valuePPB": 348.8889,
                "valueUGM3": 400,
                "aqi": 4,
                "category": "good",
                "color": "00E400",
                "method": "airnow"
            }, {
                "type": "no2",
                "name": "nitrogen dioxide",
                "valuePPB": 36,
                "valueUGM3": 68.4444,
                "aqi": 33,
                "category": "good",
                "color": "00E400",
                "method": "airnow"
            }, {
                "type": "so2",
                "name": "sulfur dioxide",
                "valuePPB": 0.3333,
                "valueUGM3": 2.2222,
                "aqi": 0,
                "category": "good",
                "color": "00E400",
                "method": "airnow"
            }]
        }],
        "profile": {
            "tz": "Asia\/Harbin",
            "sources": [{
                "name": "China National Environmental Monitoring Centre"
            }, {
                "name": "StateAir.net"
            }, {
                "name": "OpenAQ"
            }, {
                "name": "CAMS"
            }],
            "stations": ["AQCN_1004a", "AQCN_1001a", "AQCN_1006a", "AQCN_1003a", "AQO_cn85f6cf3", "AQCN_1005a", "AQCN_1011a", "AQCN_1007a", "AQCN_1012a", "AQCN_1010a"]
        }
    }]
}
								

{
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": [116.4074, 39.9042]
        },
        "properties": {
            "id": null,
            "loc": {
                "lat": 39.9042,
                "long": 116.4074
            },
            "place": {
                "name": "beijing",
                "state": "bj",
                "country": "cn"
            },
            "periods": [{
                "dateTimeISO": "2018-05-30T06:00:00+08:00",
                "timestamp": 1527631200,
                "aqi": 69,
                "category": "moderate",
                "color": "FFFF00",
                "method": "airnow",
                "dominant": "o3",
                "pollutants": [{
                    "type": "o3",
                    "name": "ozone",
                    "valuePPB": 61,
                    "valueUGM3": 122.3333,
                    "aqi": 69,
                    "category": "moderate",
                    "color": "FFFF00",
                    "method": "airnow"
                }, {
                    "type": "pm2.5",
                    "name": "particle matter (<2.5µm)",
                    "valuePPB": null,
                    "valueUGM3": 14.6,
                    "aqi": 56,
                    "category": "moderate",
                    "color": "FFFF00",
                    "method": "airnow"
                }, {
                    "type": "pm10",
                    "name": "particle matter (<10µm)",
                    "valuePPB": null,
                    "valueUGM3": 36.7778,
                    "aqi": 33,
                    "category": "good",
                    "color": "00E400",
                    "method": "airnow"
                }, {
                    "type": "co",
                    "name": "carbon monoxide",
                    "valuePPB": 348.8889,
                    "valueUGM3": 400,
                    "aqi": 4,
                    "category": "good",
                    "color": "00E400",
                    "method": "airnow"
                }, {
                    "type": "no2",
                    "name": "nitrogen dioxide",
                    "valuePPB": 36,
                    "valueUGM3": 68.4444,
                    "aqi": 33,
                    "category": "good",
                    "color": "00E400",
                    "method": "airnow"
                }, {
                    "type": "so2",
                    "name": "sulfur dioxide",
                    "valuePPB": 0.3333,
                    "valueUGM3": 2.2222,
                    "aqi": 0,
                    "category": "good",
                    "color": "00E400",
                    "method": "airnow"
                }]
            }],
            "profile": {
                "tz": "Asia\/Harbin",
                "sources": [{
                    "name": "China National Environmental Monitoring Centre"
                }, {
                    "name": "StateAir.net"
                }, {
                    "name": "OpenAQ"
                }, {
                    "name": "CAMS"
                }],
                "stations": ["AQCN_1004a", "AQCN_1001a", "AQCN_1006a", "AQCN_1003a", "AQO_cn85f6cf3", "AQCN_1005a", "AQCN_1011a", "AQCN_1007a", "AQCN_1012a", "AQCN_1010a"]
            }
        }
    }]
}
								

Response Properties

The following properties will be provided in every response object:

periods (array) Array of air quality observations
periods.#.timestamp (number) UNIX timestamp of the period.
periods.#.dateTimeISO (string) ISO 8601 date 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)
periods.#.dominant (string) The dominant pollutant. Normally set to one of the following:
- co (Carbon Monoxide)
- no2 (Nitrogen Dioxide)
- o3 (Ozone)
- pm10 (Particle Matter <10µm)
- pm2.5 (Particle Matter <2.5µm)
- so2 (Sulfur Dioxide)
periods.#.pollutants (array) Array of pollutants
periods.#.pollutants.#.type (string) The type abbreviation of the pollutant:
co = carbon monoxide
no2 = nitrogen dioxide
o3 = ozone
pm1 = partical matter (<1µm)
pm10 = partical matter (<10µm)
pm2.5 = partical matter (<2.5µm)
so2 = sulfer dioxide

Note that not all air quality stations provide information on all pollutants.
periods.#.pollutants.#.name (string) Name of the pollutant
periods.#.pollutants.#.valuePPB (number) The pollutant measurement in parts per billion. Null if this unit is not utilized

pm2.5 & pm10 do not utilize PPB.
periods.#.pollutants.#.valueUGM3 (number) The pollutant measurement in parts per micrograms per cubic meter. Null if this unit is not utilized
periods.#.pollutants.#.aqi (number) The pollutant measurement converted to the common AQI value, from 0 to 500
periods.#.pollutants.#.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.#.pollutants.#.color (string) The 6 character hexadecimal color code for the specific category.
See AirNow
profile.sources (array) Array of sources for the air quality information for this location
profile.sources.#.name (string) The name of the source
profile.stations (array) Array of the observation station IDs used to provide the air quality observation.
place.city (string) The city the observation resides in or is closest too.
loc.long (number) The longitude coordinate of the record.
loc.lat (number) The latitude coordinate of the record.
place.name (string) The place or nearest place to the record.
place.state (string) The state abbreviation in which the record is located. This may be null depending on the country.
place.country (string) The country abbreviation in which the record is located.
profile.tz (string) The timezone name association with the record's location.

Last modified: December 14, 2022