NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

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
(4.2)

From 4,614 users

3,600+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
401ms449ms453ms817ms1196ms

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.

  • lat  optional

    Latitude of desired location.

  • lon  optional

    Longitude of desired location.

  • city  optional

    City name.

  • state  optional

    US state (for United States cities only).

  • country  optional

    Country name.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • overall_aqi

    Overall Air Quality Index (AQI) value.

  • CO

    Object containing concentration (in µg/m³) and aqi (Air Quality Index for Carbon Monoxide).

  • NO2

    Object containing concentration (in µg/m³) and aqi (Air Quality Index for Nitrogen Dioxide).

  • O3

    Object containing concentration (in µg/m³) and aqi (Air Quality Index for Ozone).

  • SO2

    Object containing concentration (in µg/m³) and aqi (Air Quality Index for Sulphur Dioxide).

  • PM2.5

    Object containing concentration (in µg/m³) and aqi (Air Quality Index for PM2.5 particulates).

  • PM10

    Object containing concentration (in µg/m³) and aqi (Air Quality Index for PM10 particulates).

Sample Request Live Demo!

city
state
country
lat
lon

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=London

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
{
    overall_aqi:55,
    CO:{
      concentration:223.64,
      aqi:2
    },
    PM10:{
      concentration:3.62,
      aqi:3
    },
    SO2:{
      concentration:5.13,
      aqi:7
    },
    PM2.5:{
      concentration:1.82,
      aqi:5
    },
    O3:{
      concentration:60.8,
      aqi:55
    },
    NO2:{
      concentration:9.68,
      aqi:12
    }
}

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

  • 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.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • You can query by city name using the city parameter, optionally narrowing US locations with state or any location with country, or pin an exact point by passing both lat and lon. At least one of city or the lat/lon pair is required; you can find coordinates for a place using our Geocoding API.
  • The response returns an overall_aqi value plus a separate object for each major pollutant: CO, NO2, O3, SO2, PM2.5, and PM10. Each pollutant object contains its concentration (in µg/m³) and its individual aqi score, and you can test the full output live on the API documentation page.
  • 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.