← Back to API Ninjas
Get air quality by city or location coordinates.
Returns the Air Quality Index plus CO, NO2, O3, SO2, PM2.5 and PM10 concentrations for a location. Requires a `city` or `lat`/`lon`; `state` and `country` disambiguate city names.
API Ninjas·$0.001 per call
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/airquality"
});
console.log(output);Query parameters
lat
string
Latitude of desired location. Provide both lat and lon, or use city instead.
lon
string
Longitude of desired location. Provide both lat and lon, or use city instead.
city
string
City name. Provide either city or both lat and lon.
state
string
US state (for United States cities only).
country
string
Country name.