IQAir AirVisual Cities API
List supported cities and retrieve city air quality data
List supported cities and retrieve city air quality data
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/airvisual:airvisual-cities-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: IQAir AirVisual Cities API
description: The IQAir AirVisual API provides real-time and forecast air quality and weather data worldwide. It offers endpoints for listing supported countries, states, and cities, retrieving air quality data for specific locations or nearest stations, and ranking cities by air quality index.
version: 2.0.0
contact:
name: IQAir
url: https://www.iqair.com
servers:
- url: https://api.airvisual.com/v2
description: IQAir AirVisual API v2
security:
- apiKey: []
tags:
- name: Cities
description: List supported cities and retrieve city air quality data
paths:
/cities:
get:
tags:
- Cities
summary: List supported cities
description: Returns a list of all supported cities within a specified state and country.
operationId: listCities
parameters:
- name: key
in: query
required: true
description: Your API key
schema:
type: string
- name: state
in: query
required: true
description: State name
schema:
type: string
example: California
- name: country
in: query
required: true
description: Country name
schema:
type: string
example: USA
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/CitiesResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/city:
get:
tags:
- Cities
summary: Get city air quality data
description: Returns air quality and weather data for a specified city, including current conditions, forecasts, and history.
operationId: getCity
parameters:
- name: key
in: query
required: true
description: Your API key
schema:
type: string
- name: city
in: query
required: true
description: City name
schema:
type: string
example: Los Angeles
- name: state
in: query
required: true
description: State name
schema:
type: string
example: California
- name: country
in: query
required: true
description: Country name
schema:
type: string
example: USA
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/CityDataResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/nearest_city:
get:
tags:
- Cities
summary: Get nearest city air quality data
description: Returns air quality data for the nearest city based on IP geolocation or provided GPS coordinates.
operationId: getNearestCity
parameters:
- name: key
in: query
required: true
description: Your API key
schema:
type: string
- name: lat
in: query
required: false
description: Latitude coordinate. If not provided, IP-based geolocation is used.
schema:
type: number
format: double
example: 34.0522
- name: lon
in: query
required: false
description: Longitude coordinate. If not provided, IP-based geolocation is used.
schema:
type: number
format: double
example: -118.2437
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/CityDataResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
GeoLocation:
type: object
properties:
type:
type: string
description: GeoJSON type
example: Point
coordinates:
type: array
items:
type: number
format: double
description: Longitude and latitude coordinates
example:
- -118.2437
- 34.0522
Pollution:
type: object
properties:
ts:
type: string
format: date-time
description: Timestamp
aqius:
type: integer
description: AQI value based on US EPA standard
mainus:
type: string
description: Main pollutant for US AQI (p2=PM2.5, p1=PM10, o3=Ozone, n2=NO2, s2=SO2, co=CO)
aqicn:
type: integer
description: AQI value based on China MEP standard
maincn:
type: string
description: Main pollutant for Chinese AQI
p2:
$ref: '#/components/schemas/PollutantUnit'
p1:
$ref: '#/components/schemas/PollutantUnit'
o3:
$ref: '#/components/schemas/PollutantUnit'
n2:
$ref: '#/components/schemas/PollutantUnit'
s2:
$ref: '#/components/schemas/PollutantUnit'
co:
$ref: '#/components/schemas/PollutantUnit'
Weather:
type: object
properties:
ts:
type: string
format: date-time
description: Timestamp
tp:
type: number
description: Temperature in Celsius
pr:
type: number
description: Atmospheric pressure in hPa
hu:
type: number
description: Humidity percentage
ws:
type: number
description: Wind speed in m/s
wd:
type: number
description: Wind direction as angle (N=0, E=90, S=180, W=270)
ic:
type: string
description: Weather icon code
Current:
type: object
properties:
weather:
$ref: '#/components/schemas/Weather'
pollution:
$ref: '#/components/schemas/Pollution'
CitiesResponse:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: object
properties:
city:
type: string
description: City name
PollutantUnit:
type: object
properties:
conc:
type: number
description: Pollutant concentration
aqius:
type: integer
description: AQI value based on US EPA standard
aqicn:
type: integer
description: AQI value based on China MEP standard
CityData:
type: object
properties:
city:
type: string
description: City name
state:
type: string
description: State name
country:
type: string
description: Country name
location:
$ref: '#/components/schemas/GeoLocation'
current:
$ref: '#/components/schemas/Current'
forecasts:
type: array
items:
$ref: '#/components/schemas/Forecast'
history:
type: object
properties:
weather:
type: array
items:
$ref: '#/components/schemas/Weather'
pollution:
type: array
items:
$ref: '#/components/schemas/Pollution'
Forecast:
type: object
properties:
ts:
type: string
format: date-time
description: Timestamp
aqius:
type: integer
description: AQI value based on US EPA standard
aqicn:
type: integer
description: AQI value based on China MEP standard
tp:
type: number
description: Temperature in Celsius
tp_min:
type: number
description: Minimum temperature in Celsius
pr:
type: number
description: Atmospheric pressure in hPa
hu:
type: number
description: Humidity percentage
ws:
type: number
description: Wind speed in m/s
wd:
type: number
description: Wind direction as angle
ic:
type: string
description: Weather icon code
CityDataResponse:
type: object
properties:
status:
type: string
example: success
data:
$ref: '#/components/schemas/CityData'
ErrorResponse:
type: object
properties:
status:
type: string
example: fail
data:
type: object
properties:
message:
type: string
description: Error message
securitySchemes:
apiKey:
type: apiKey
in: query
name: key
description: API key passed as a query parameter.