{"openapi":"3.1.0","info":{"title":"Atmy air quality API for agents","version":"1.0","summary":"Current and daily PM2.5 for cities, from public and citizen sensor networks after the Atmy Data Hub quality check.","description":"Read-only, no key. Values are approximate: low-cost optical sensors, not official monitoring. A city's sensors are those the Data Hub assigns to it that pass its nightly quality check; a value needs sensors at four places 500 m apart. \"now\" is the mean of the latest reading of each sensor (at most 60 minutes old), rebuilt every 15 minutes; \"completed_day\" and \"history\" are the Data Hub's daily means of the completed UTC day (sensors with at least 12 valid hours). Categories use the US EPA 2024 PM2.5 breakpoints. Attribute as \"Atmy (atmy.ai)\". Rate limit: 60 requests per minute per IP.","contact":{"url":"https://atmy.ai/"},"license":{"name":"Atmy data terms","url":"https://atmy.ai/legal/data/"}},"externalDocs":{"description":"Documentation with examples, in 17 languages","url":"https://atmy.ai/air-quality/api/"},"paths":{"/air-quality/current":{"get":{"operationId":"getCurrentAirQuality","summary":"Air quality in a city now and on the last completed day","description":"Find the city by name (any of 17 languages), slug or id, or by coordinates (the nearest city with an Atmy summary within 50 km).","parameters":[{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/country"},{"name":"lat","in":"query","schema":{"type":"number","minimum":-90,"maximum":90},"description":"Latitude, with lon, instead of city."},{"name":"lon","in":"query","schema":{"type":"number","minimum":-180,"maximum":180},"description":"Longitude, with lat."},{"$ref":"#/components/parameters/lang"}],"responses":{"200":{"description":"The city, its current value and its completed day.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Current"}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/air-quality/history":{"get":{"operationId":"getDailyAirQuality","summary":"Daily PM2.5 of a city for up to 400 completed days","parameters":[{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/country"},{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":400,"default":30}},{"$ref":"#/components/parameters/lang"}],"responses":{"200":{"description":"Daily means; a day without enough sensors is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/History"}}}},"404":{"$ref":"#/components/responses/Error"}}}},"/cities":{"get":{"operationId":"listCities","summary":"Cities with an Atmy summary","parameters":[{"$ref":"#/components/parameters/country"},{"$ref":"#/components/parameters/lang"}],"responses":{"200":{"description":"The cities, their pages and current endpoints."}}}}},"components":{"parameters":{"city":{"name":"city","in":"query","schema":{"type":"string"},"examples":{"name":{"value":"Krasnoyarsk"},"slug":{"value":"russia/krasnoyarsk"},"localName":{"value":"Красноярск"}},"description":"City name in any site language, slug (country/city or city) or id."},"country":{"name":"country","in":"query","schema":{"type":"string"},"description":"Country name or slug to tell cities with one name apart."},"lang":{"name":"lang","in":"query","schema":{"type":"string","enum":["en","ru","de","fr","es","it","pt-BR","pl","cs","hu","ro","bg","sr","id","hi","ja","zh"],"default":"en"},"description":"Language of names and of the page link."}},"responses":{"Error":{"description":"error.code: city_required, invalid_coordinates, unknown_city, no_city_nearby, ambiguous_city (with candidates) or not_available.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"candidates":{"type":"array","items":{"type":"object"}}}}}}}}}},"schemas":{"Category":{"type":"object","properties":{"scale":{"const":"US_EPA_2024"},"level":{"type":"string","enum":["good","moderate","unhealthy_for_sensitive_groups","unhealthy","very_unhealthy","hazardous"]}}},"City":{"type":"object","properties":{"id":{"type":"integer"},"slug":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"timezone":{"type":"string"},"center":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"}}},"distance_km":{"type":"number"},"page":{"type":"string","format":"uri"}}},"Current":{"type":"object","properties":{"city":{"$ref":"#/components/schemas/City"},"now":{"type":"object","description":"status current: the latest readings; stale: no fresh readings from enough places (no values).","properties":{"status":{"type":"string","enum":["current","stale"]},"pm25":{"type":"number"},"median":{"type":"number"},"min":{"type":"number"},"max":{"type":"number"},"unit":{"const":"ug/m3"},"category":{"$ref":"#/components/schemas/Category"},"sensors":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"}}},"completed_day":{"type":["object","null"],"description":"The Data Hub's mean of the last completed UTC day; null when the city had too few sensors.","properties":{"date":{"type":"string","format":"date"},"pm25":{"type":"number"},"sensors":{"type":"integer"},"category":{"$ref":"#/components/schemas/Category"}}},"attribution":{"type":"string"}}},"History":{"type":"object","properties":{"city":{"$ref":"#/components/schemas/City"},"days":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"pm25":{"type":"number"},"sensors":{"type":"integer"},"level":{"type":"string"}}}}}}}},"servers":[{"url":"https://api.atmy.ai/v1"}]}