openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Air Quality Intelligence Platform API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: cities description: City operations - name: aqi description: Air Quality Index operations - name: alerts description: Alert operations - name: dashboard description: Dashboard summary operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /cities: get: operationId: getCities tags: [cities] summary: List all monitored cities responses: "200": description: List of cities content: application/json: schema: type: array items: $ref: "#/components/schemas/City" /current: get: operationId: getCurrentAqi tags: [aqi] summary: Get current AQI for a city parameters: - name: city in: query required: true schema: type: string responses: "200": description: Current AQI reading content: application/json: schema: $ref: "#/components/schemas/CurrentAqi" /aqi-trends: get: operationId: getAqiTrends tags: [aqi] summary: Get historical AQI trend for a city parameters: - name: city in: query required: true schema: type: string - name: days in: query required: false schema: type: integer default: 7 responses: "200": description: AQI trend data content: application/json: schema: type: array items: $ref: "#/components/schemas/AqiTrendPoint" /pollutants: get: operationId: getPollutants tags: [aqi] summary: Get pollutant breakdown for a city parameters: - name: city in: query required: true schema: type: string responses: "200": description: Pollutant breakdown content: application/json: schema: type: array items: $ref: "#/components/schemas/PollutantReading" /alerts: get: operationId: getAlerts tags: [alerts] summary: Get air quality alerts parameters: - name: city in: query required: false schema: type: string responses: "200": description: List of alerts content: application/json: schema: type: array items: $ref: "#/components/schemas/Alert" /dashboard/summary: get: operationId: getDashboardSummary tags: [dashboard] summary: Get global dashboard summary statistics responses: "200": description: Dashboard summary content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" /dashboard/rankings: get: operationId: getCityRankings tags: [dashboard] summary: Get cities ranked by AQI (best to worst air quality) responses: "200": description: City rankings content: application/json: schema: type: array items: $ref: "#/components/schemas/CityRanking" components: schemas: HealthStatus: type: object properties: status: type: string required: - status City: type: object properties: id: type: string name: type: string country: type: string region: type: string latitude: type: number longitude: type: number stationCount: type: integer required: - id - name - country - region - latitude - longitude - stationCount AqiCategory: type: string enum: - Good - Moderate - Unhealthy for Sensitive Groups - Unhealthy - Very Unhealthy - Hazardous CurrentAqi: type: object properties: city: type: string aqi: type: number category: $ref: "#/components/schemas/AqiCategory" dominantPollutant: type: string temperature: type: number humidity: type: number windSpeed: type: number updatedAt: type: string format: date-time required: - city - aqi - category - dominantPollutant - temperature - humidity - windSpeed - updatedAt AqiTrendPoint: type: object properties: timestamp: type: string format: date-time aqi: type: number category: $ref: "#/components/schemas/AqiCategory" pm25: type: number pm10: type: number required: - timestamp - aqi - category - pm25 - pm10 PollutantReading: type: object properties: pollutant: type: string value: type: number unit: type: string aqiContribution: type: number safe_limit: type: number status: type: string enum: [safe, moderate, unhealthy, hazardous] required: - pollutant - value - unit - aqiContribution - safe_limit - status Alert: type: object properties: id: type: string city: type: string severity: type: string enum: [info, warning, critical] message: type: string pollutant: type: string value: type: number threshold: type: number createdAt: type: string format: date-time active: type: boolean required: - id - city - severity - message - pollutant - value - threshold - createdAt - active DashboardSummary: type: object properties: totalCities: type: integer totalStations: type: integer activeAlerts: type: integer citiesAboveThreshold: type: integer globalAverageAqi: type: number cleanestCity: type: string mostPollutedCity: type: string lastUpdated: type: string format: date-time required: - totalCities - totalStations - activeAlerts - citiesAboveThreshold - globalAverageAqi - cleanestCity - mostPollutedCity - lastUpdated CityRanking: type: object properties: rank: type: integer city: type: string country: type: string aqi: type: number category: $ref: "#/components/schemas/AqiCategory" change24h: type: number required: - rank - city - country - aqi - category - change24h