{
  "openapi": "3.1.0",
  "info": {
    "title": "Air Quality API",
    "version": "1.0.0",
    "description": "Nearest-station PM2.5, ozone and US AQI readings for any coordinates.\n\nLatest air-quality readings — PM2.5, PM10, ozone, NO2, SO2, CO and more — from the nearest government and research-grade monitoring station to any coordinates, with a computed US EPA AQI (value, category, dominant pollutant), per-pollutant timestamps and staleness flags, a nearby-station directory, station detail and a pollutant catalogue. Open data via OpenAQ under each station's own government licence (public domain, CC BY, ODC-BY, UK OGL and similar; non-commercial stations excluded), edge-cached for 15 minutes.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/air-quality.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/air-quality"
  },
  "servers": [
    {
      "url": "https://api-air-quality.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Data",
      "description": "Air Quality API belongs to the Data category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/sources": {
      "get": {
        "operationId": "dataSources",
        "summary": "Data Sources",
        "description": "Data Sources endpoint of the Air Quality API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/air-quality/data-sources"
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "sources": [
                    {
                      "name": "OpenAQ v3 API",
                      "url": "https://docs.openaq.org",
                      "provides": "Latest readings and metadata for government and research-grade monitoring stations worldwide.",
                      "licensing": "Per originating agency — US Public Domain, CC0, CC BY, ODC-BY, UK OGL and similar attribution licences; non-commercial licences are excluded."
                    }
                  ],
                  "attribution": {
                    "source": "OpenAQ — government and research-grade air-quality monitoring stations",
                    "source_url": "https://openaq.org",
                    "note": "Each station carries the licence of its originating agency (see the station's license/attribution fields); stations whose licence forbids commercial use are excluded. Readings are edge-cached for up to 15 minutes; readings older than 24 hours are flagged stale."
                  },
                  "aqi": {
                    "scale": "US EPA AQI",
                    "url": "https://www.airnow.gov/aqi/aqi-basics/",
                    "pollutants": [
                      "pm25",
                      "pm10"
                    ]
                  },
                  "cache_seconds": 900,
                  "stale_after_hours": 24
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/stations": {
      "get": {
        "operationId": "nearbyStations",
        "summary": "Nearby Stations",
        "description": "Nearby Stations endpoint of the Air Quality API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/air-quality/nearby-stations"
        },
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "40.71"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "5"
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "-74.0"
          },
          {
            "name": "radius",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "10"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "latitude": 40.71,
                  "longitude": -74,
                  "radius_km": 10,
                  "count": 5,
                  "stations": [
                    {
                      "id": 662,
                      "name": "Division Street",
                      "locality": null,
                      "country": "US",
                      "latitude": 40.7142,
                      "longitude": -73.995,
                      "distance_km": 0.6,
                      "provider": "AirNow",
                      "reference_monitor": true,
                      "mobile": false,
                      "timezone": "America/New_York",
                      "parameters": [
                        "pm25"
                      ],
                      "last_updated": "2020-02-19T16:00:00Z",
                      "active": false,
                      "license": "US Public Domain",
                      "attribution": "Unknown Governmental Organization"
                    },
                    {
                      "id": 642,
                      "name": "PS 19",
                      "locality": null,
                      "country": "US",
                      "latitude": 40.73,
                      "longitude": -73.984459,
                      "distance_km": 2.6,
                      "provider": "AirNow",
                      "reference_monitor": true,
                      "mobile": false,
                      "timezone": "America/New_York",
                      "parameters": [
                        "pm25"
                      ],
                      "last_updated": "2017-12-18T10:00:00Z",
                      "active": false,
                      "license": "US Public Domain",
                      "attribution": "Unknown Governmental Organization"
                    },
                    {
                      "id": 664,
                      "name": "Bklyn - PS274",
                      "locality": "New York-Northern New Jersey-Long Island",
                      "country": "US",
                      "latitude": 40.694401,
                      "longitude": -73.928596,
                      "distance_km": 6.3,
                      "provider": "AirNow",
                      "reference_monitor": true,
                      "mobile": false,
                      "timezone": "America/New_York",
                      "parameters": [
                        "pm25"
                      ],
                      "last_updated": "2026-09-12T06:00:00Z",
                      "active": true,
                      "license": "US Public Domain",
                      "attribution": "Unknown Governmental Organization"
                    },
                    {
                      "id": 648,
                      "name": "Bklyn - PS 314",
                      "locality": "KINGS",
                      "country": "US",
                      "latitude": 40.641819,
                      "longitude": -74.018707,
                      "distance_km": 7.7,
                      "provider": "AirNow",
                      "reference_monitor": true,
                      "mobile": false,
                      "timezone": "America/New_York",
                      "parameters": [
                        "pm25"
                      ],
                      "last_updated": "2026-09-12T06:00:00Z",
                      "active": true,
                      "license": "US Public Domain",
                      "attribution": "Unknown Governmental Organization"
                    },
                    {
                      "id": 628,
                      "name": "Maspeth",
                      "locality": "New York-Northern New Jersey-Long Island",
                      "country": "US",
                      "latitude": 40.7269,
                      "longitude": -73.8933,
                      "distance_km": 9.2,
                      "provider": "AirNow",
                      "reference_monitor": true,
                      "mobile": false,
                      "timezone": "America/New_York",
                      "parameters": [
                        "pm25"
                      ],
                      "last_updated": "2026-09-12T06:00:00Z",
                      "active": true,
                      "license": "US Public Domain",
                      "attribution": "Unknown Governmental Organization"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/air-quality": {
      "get": {
        "operationId": "nearestReadings",
        "summary": "Nearest Readings",
        "description": "Nearest Readings endpoint of the Air Quality API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/air-quality/nearest-readings"
        },
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "40.71"
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "-74.0"
          },
          {
            "name": "radius",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "25"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "latitude": 40.71,
                  "longitude": -74,
                  "station": {
                    "id": 664,
                    "name": "Bklyn - PS274",
                    "locality": "New York-Northern New Jersey-Long Island",
                    "country": "US",
                    "latitude": 40.694401,
                    "longitude": -73.928596,
                    "distance_km": 6.3,
                    "provider": "AirNow",
                    "reference_monitor": true,
                    "mobile": false,
                    "timezone": "America/New_York",
                    "parameters": [
                      "pm25"
                    ],
                    "last_updated": "2026-09-12T06:00:00Z",
                    "active": true,
                    "license": "US Public Domain",
                    "attribution": "Unknown Governmental Organization"
                  },
                  "stale": false,
                  "aqi_us": {
                    "value": 33,
                    "category": "Good",
                    "dominant_pollutant": "pm25",
                    "by_pollutant": {
                      "pm25": 33
                    },
                    "note": "US EPA AQI computed from the latest particulate readings using the 24-hour breakpoints (2024 PM2.5 scale); gases are not included."
                  },
                  "measurements": [
                    {
                      "parameter": "pm25",
                      "display_name": "PM2.5",
                      "value": 5.9,
                      "unit": "µg/m³",
                      "last_updated": "2026-09-12T06:00:00Z",
                      "age_hours": 0.6,
                      "stale": false
                    }
                  ],
                  "nearby_stations": [
                    {
                      "id": 662,
                      "name": "Division Street",
                      "distance_km": 0.6,
                      "last_updated": "2020-02-19T16:00:00Z"
                    },
                    {
                      "id": 642,
                      "name": "PS 19",
                      "distance_km": 2.6,
                      "last_updated": "2017-12-18T10:00:00Z"
                    },
                    {
                      "id": 648,
                      "name": "Bklyn - PS 314",
                      "distance_km": 7.7,
                      "last_updated": "2026-09-12T06:00:00Z"
                    },
                    {
                      "id": 628,
                      "name": "Maspeth",
                      "distance_km": 9.2,
                      "last_updated": "2026-09-12T06:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/parameters": {
      "get": {
        "operationId": "pollutantParameters",
        "summary": "Pollutant Parameters",
        "description": "Pollutant Parameters endpoint of the Air Quality API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/air-quality/pollutant-parameters"
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "count": 44,
                  "parameters": [
                    {
                      "code": "bc",
                      "display_name": "BC",
                      "unit": "µg/m³",
                      "description": "Black Carbon mass concentration"
                    },
                    {
                      "code": "bc_370",
                      "display_name": "BC 370nm",
                      "unit": "ng/m³",
                      "description": "Black Carbon mass concentration 375nm "
                    },
                    {
                      "code": "bc_375",
                      "display_name": "BC 375nm",
                      "unit": "ng/m³",
                      "description": "Black Carbon mass concentration 375nm "
                    },
                    {
                      "code": "bc_470",
                      "display_name": "BC 470nm",
                      "unit": "ng/m³",
                      "description": "Black Carbon mass concentration 470nm "
                    },
                    {
                      "code": "bc_528",
                      "display_name": "BC 528nm",
                      "unit": "ng/m³",
                      "description": "Black Carbon mass concentration 528nm "
                    },
                    {
                      "code": "bc_625",
                      "display_name": "BC 625nm",
                      "unit": "ng/m³",
                      "description": "Black Carbon mass concentration 625nm "
                    },
                    {
                      "code": "bc_880",
                      "display_name": "BC 880nm",
                      "unit": "ng/m³",
                      "description": "Black Carbon mass concentration 880nm "
                    },
                    {
                      "code": "ch4",
                      "display_name": "CH₄",
                      "unit": "ppm",
                      "description": "Methane concentration"
                    },
                    {
                      "code": "co",
                      "display_name": "CO mass",
                      "unit": "µg/m³",
                      "description": "Carbon Monoxide mass concentration"
                    },
                    {
                      "code": "co",
                      "display_name": "CO",
                      "unit": "ppm",
                      "description": "Carbon Monoxide concentration"
                    },
                    {
                      "code": "co",
                      "display_name": "CO",
                      "unit": "ppb",
                      "description": null
                    },
                    {
                      "code": "co2",
                      "display_name": "CO₂",
                      "unit": "ppm",
                      "description": "Carbon Dioxide concentration"
                    },
                    {
                      "code": "humidity",
                      "display_name": "H",
                      "unit": "%",
                      "description": null
                    },
                    {
                      "code": "no",
                      "display_name": "NO",
                      "unit": "ppb",
                      "description": null
                    },
                    {
                      "code": "no",
                      "display_name": "NO",
                      "unit": "ppm",
                      "description": "Nitrogen Monoxide concentration"
                    },
                    {
                      "code": "no",
                      "display_name": "NO mass",
                      "unit": "µg/m³",
                      "description": "Nitrogen Monoxide mass concentration"
                    },
                    {
                      "code": "no2",
                      "display_name": "NO₂ mass",
                      "unit": "µg/m³",
                      "description": "Nitrogen Dioxide mass concentration"
                    },
                    {
                      "code": "no2",
                      "display_name": "NO₂",
                      "unit": "ppm",
                      "description": "Nitrogen Dioxide concentration"
                    },
                    {
                      "code": "no2",
                      "display_name": "NO₂",
                      "unit": "ppb",
                      "description": null
                    },
                    {
                      "code": "nox",
                      "display_name": "NOX",
                      "unit": "ppb",
                      "description": null
                    },
                    {
                      "code": "nox",
                      "display_name": "NOx mass",
                      "unit": "µg/m³",
                      "description": "Nitrogen Oxides mass concentration"
                    },
                    {
                      "code": "nox",
                      "display_name": "NOx",
                      "unit": "ppm",
                      "description": "Nitrogen Oxides concentration"
                    },
                    {
                      "code": "o3",
                      "display_name": "O₃ mass",
                      "unit": "µg/m³",
                      "description": "Ozone mass concentration"
                    },
                    {
                      "code": "o3",
                      "display_name": "O₃",
                      "unit": "ppm",
                      "description": "Ozone concentration"
                    },
                    {
                      "code": "o3",
                      "display_name": "O₃",
                      "unit": "ppb",
                      "description": null
                    },
                    {
                      "code": "pm1",
                      "display_name": "PM1",
                      "unit": "µg/m³",
                      "description": "Particulate matter less than 1 micrometer in diameter mass concentration"
                    },
                    {
                      "code": "pm10",
                      "display_name": "PM10",
                      "unit": "µg/m³",
                      "description": "Particulate matter less than 10 micrometers in diameter mass concentration"
                    },
                    {
                      "code": "pm25",
                      "display_name": "PM2.5",
                      "unit": "µg/m³",
                      "description": "Particulate matter less than 2.5 micrometers in diameter mass concentration"
                    },
                    {
                      "code": "pm4",
                      "display_name": "PM4.0",
                      "unit": "µg/m³",
                      "description": "Particulate matter less than 4 micrometers in diameter mass concentration"
                    },
                    {
                      "code": "pressure",
                      "display_name": "Atmospheric pressure",
                      "unit": "hpa",
                      "description": "Atmospheric or barometric pressure"
                    },
                    {
                      "code": "pressure",
                      "display_name": "Pressure",
                      "unit": "mb",
                      "description": null
                    },
                    {
                      "code": "relativehumidity",
                      "display_name": "RH",
                      "unit": "%",
                      "description": null
                    },
                    {
                      "code": "so2",
                      "display_name": "SO₂ mass",
                      "unit": "µg/m³",
                      "description": "Sulfur Dioxide mass concentration"
                    },
                    {
                      "code": "so2",
                      "display_name": "SO₂",
                      "unit": "ppm",
                      "description": "Sulfur Dioxide concentration"
                    },
                    {
                      "code": "so2",
                      "display_name": "SO₂",
                      "unit": "ppb",
                      "description": null
                    },
                    {
                      "code": "temperature",
                      "display_name": "Temperature (C)",
                      "unit": "c",
                      "description": null
                    },
                    {
                      "code": "temperature",
                      "display_name": "Temperature (F)",
                      "unit": "f",
                      "description": null
                    },
                    {
                      "code": "ufp",
                      "display_name": "UFP count",
                      "unit": "particles/cm³",
                      "description": "Ultrafine Particles count concentration"
                    },
                    {
                      "code": "um003",
                      "display_name": "PM0.3 count",
                      "unit": "particles/cm³",
                      "description": null
                    },
                    {
                      "code": "um010",
                      "display_name": "PM1 count",
                      "unit": "particles/cm³",
                      "description": "PM1 count"
                    },
                    {
                      "code": "um025",
                      "display_name": "PM2.5 count",
                      "unit": "particles/cm³",
                      "description": "PM2.5 count"
                    },
                    {
                      "code": "um100",
                      "display_name": "PM10 count",
                      "unit": "particles/cm³",
                      "description": "PM10 count"
                    },
                    {
                      "code": "wind_direction",
                      "display_name": "Wind direction",
                      "unit": "deg",
                      "description": "Direction that the wind originates from"
                    },
                    {
                      "code": "wind_speed",
                      "display_name": "Wind speed",
                      "unit": "m/s",
                      "description": "Average wind speed in meters per second"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/stations/{id}": {
      "get": {
        "operationId": "stationDetail",
        "summary": "Station Detail",
        "description": "Station Detail endpoint of the Air Quality API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/air-quality/station-detail"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "664"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "station": {
                    "id": 664,
                    "name": "Bklyn - PS274",
                    "locality": "New York-Northern New Jersey-Long Island",
                    "country": "US",
                    "latitude": 40.694401,
                    "longitude": -73.928596,
                    "distance_km": null,
                    "provider": "AirNow",
                    "reference_monitor": true,
                    "mobile": false,
                    "timezone": "America/New_York",
                    "parameters": [
                      "pm25"
                    ],
                    "last_updated": "2026-09-12T05:00:00Z",
                    "active": true,
                    "license": "US Public Domain",
                    "attribution": "Unknown Governmental Organization",
                    "first_reading": "2016-03-10T08:00:00Z"
                  },
                  "stale": false,
                  "aqi_us": {
                    "value": 33,
                    "category": "Good",
                    "dominant_pollutant": "pm25",
                    "by_pollutant": {
                      "pm25": 33
                    },
                    "note": "US EPA AQI computed from the latest particulate readings using the 24-hour breakpoints (2024 PM2.5 scale); gases are not included."
                  },
                  "measurements": [
                    {
                      "parameter": "pm25",
                      "display_name": "PM2.5",
                      "value": 5.9,
                      "unit": "µg/m³",
                      "last_updated": "2026-09-12T06:00:00Z",
                      "age_hours": 0.6,
                      "stale": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 10 tokens per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}