Air Quality API
The Air Quality API provides the latest air quality information for any city or geographic location in the world. It provides not only the holistic Air Quality Index (AQI) but also concentrations for major pollutants:
- Carbon monoxide (CO)
- Nitrogen dioxide (NO2)
- Ozone (O3)
- Sulphur dioxide (SO2)
- PM2.5 particulates
- PM10 particulates
From 4,614 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 401ms | 449ms | 453ms | 817ms | 1196ms |
Didn't find what you were looking for? Suggest an improvement
/v1/airquality GET
https://api.api-ninjas.com/v1/airquality
Get air quality by city or location coordinates (latitude/longitude). Returns the air quality index (AQI) and concentrations of major pollutants.
Parameters
Note: at least one of the following must be provided: lat and lon, or city.
latoptionalLatitude of desired location.
lonoptionalLongitude of desired location.
cityoptionalCity name.
stateoptionalUS state (for United States cities only).
countryoptionalCountry name.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
overall_aqiOverall Air Quality Index (AQI) value.
COObject containing
concentration(in µg/m³) andaqi(Air Quality Index for Carbon Monoxide).NO2Object containing
concentration(in µg/m³) andaqi(Air Quality Index for Nitrogen Dioxide).O3Object containing
concentration(in µg/m³) andaqi(Air Quality Index for Ozone).SO2Object containing
concentration(in µg/m³) andaqi(Air Quality Index for Sulphur Dioxide).PM2.5Object containing
concentration(in µg/m³) andaqi(Air Quality Index for PM2.5 particulates).PM10Object containing
concentration(in µg/m³) andaqi(Air Quality Index for PM10 particulates).
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/airquality?city=LondonHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/airquality?city=london" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Air Quality API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Air Quality API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Air Quality API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Air Quality API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.How do I look up air quality for a specific location?
You can query by city name using thecityparameter, optionally narrowing US locations withstateor any location withcountry, or pin an exact point by passing bothlatandlon. At least one ofcityor thelat/lonpair is required; you can find coordinates for a place using our Geocoding API.What does the Air Quality API response include?
The response returns anoverall_aqivalue plus a separate object for each major pollutant:CO,NO2,O3,SO2,PM2.5, andPM10. Each pollutant object contains itsconcentration(in µg/m³) and its individualaqiscore, and you can test the full output live on the API documentation page.What are some use cases for the Air Quality API?
It is well suited for health and wellness apps, smart-home dashboards, travel planners, and environmental monitoring tools that need current AQI and pollutant levels for any city worldwide. It pairs naturally with our Weather API and City API to enrich a location with conditions and metadata; see pricing for usage tiers.