{"openapi":"3.1.0","info":{"title":"Haze Day API","version":"1.0.0","summary":"Live haze (PM2.5) readings, advice, rankings, fire hotspots and news for Southeast Asia.","description":"Free, public, no key. Cross-origin requests are allowed and responses are cached for 5 to 30 minutes, so please do not poll more often than every few minutes.\n\nSingapore figures are official NEA readings, and Malaysian figures are the nearest DOE station's official hourly PM2.5 when it is fresh (`basis: official`, see `officialBy`); everything else is a CAMS model estimate (`basis: modelled`) and must not be presented as an official reading. PM2.5 is in µg/m³.\n\nHaze Day's own data (advice, rankings, summaries) is CC BY 4.0: credit \"Haze Day (haze.day)\" with a link. Third-party data keeps its own terms: NEA / data.gov.sg (Singapore Open Data Licence), Open-Meteo / CAMS (CC BY 4.0), NASA FIRMS, and news headlines (their publishers).","termsOfService":"https://haze.day/en/developers","contact":{"name":"Haze Day","url":"https://github.com/maweis1981/haze-guide/issues"},"license":{"name":"CC BY 4.0 (Haze Day's own data)","identifier":"CC-BY-4.0"}},"externalDocs":{"description":"Developer page","url":"https://haze.day/en/developers"},"servers":[{"url":"https://haze.day"}],"security":[],"tags":[{"name":"readings","description":"Current reading, advice and outlook for one place"},{"name":"ranking","description":"All places ranked by PM2.5"},{"name":"map","description":"Model PM2.5 grid, wind and fire detections"},{"name":"news","description":"Aggregated haze headlines"}],"paths":{"/api/now":{"get":{"operationId":"getNow","tags":["readings"],"summary":"Current reading, weather, likely cause, advice and 24-hour outlook","description":"Pass a place id, or lat and lon for any location (inside Singapore the nearest NEA region is used).","parameters":[{"name":"place","in":"query","schema":{"type":"string","enum":["sg","kl","jb","kuching","bn","pekanbaru","palembang","jakarta","bkk","penang","ipoh","melaka","shah-alam","klang","petaling-jaya","seremban","kuantan","kota-bharu","kuala-terengganu","alor-setar","kota-kinabalu","miri","sibu","putrajaya","jambi","pontianak","palangkaraya","medan","batam","banjarmasin","balikpapan","chiang-mai","hat-yai","phuket","kangar","labuan","kluang","muar","taiping","sandakan","tawau","bintulu","dumai","padang","bengkulu","bandar-lampung","surabaya","bandung","semarang","makassar","manado","denpasar","yogyakarta","samarinda","palu","pangkal-pinang","chiang-rai","khon-kaen","pattaya","nakhon-ratchasima","phitsanulok","surat-thani","hanoi","ho-chi-minh-city","da-nang","hai-phong","can-tho","manila","cebu","davao","baguio","phnom-penh","siem-reap","vientiane","luang-prabang","yangon","mandalay","naypyidaw","dili"],"default":"sg"},"description":"City id; ignored when lat and lon are given."},{"name":"lat","in":"query","required":false,"schema":{"type":"number"},"example":1.35,"description":"Latitude; requires lon."},{"name":"lon","in":"query","required":false,"schema":{"type":"number"},"example":103.82,"description":"Longitude; requires lat."},{"name":"cutoff","in":"query","schema":{"type":"integer","minimum":1,"default":110},"description":"1-hour PM2.5 cut-off used by the team-sport advice."},{"name":"sensitive","in":"query","schema":{"type":"string","enum":["1"]},"description":"Set to 1 for advice for vulnerable people."}],"responses":{"200":{"description":"Snapshot for the place.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Snapshot"}}}},"400":{"description":"Missing or invalid coordinates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ranking":{"get":{"operationId":"getRanking","tags":["ranking"],"summary":"All places ranked by current 1-hour PM2.5","responses":{"200":{"description":"Ranking, worst first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ranking"}}}}}}},"/api/map/grid":{"get":{"operationId":"getMapGrid","tags":["map"],"summary":"Regional PM2.5 model grid (-12 h to +24 h) and 1.5 km wind","parameters":[{"name":"lat","in":"query","required":true,"schema":{"type":"number"},"example":1.35},{"name":"lon","in":"query","required":true,"schema":{"type":"number"},"example":103.82}],"responses":{"200":{"description":"Grid around the point.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapGrid"}}}},"400":{"description":"Missing or invalid coordinates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Upstream model unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/map/hotspots":{"get":{"operationId":"getHotspots","tags":["map"],"summary":"VIIRS fire detections from the last 24 hours","responses":{"200":{"description":"Fire detections.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Hotspots"}}}},"502":{"description":"Satellite feed unavailable (empty points).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Hotspots"}}}}}}},"/api/news":{"get":{"operationId":"getNews","tags":["news"],"summary":"Aggregated haze headlines with links to the publishers","responses":{"200":{"description":"Headline clusters, newest first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/News"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"detail":{"type":"string"}},"required":["error"]},"Localized":{"type":"object","properties":{"en":{"type":"string"},"zh":{"type":"string"},"ms":{"type":"string"},"id":{"type":"string"}},"required":["en","zh","ms","id"],"description":"The same text in English, Simplified Chinese, Malay and Indonesian."},"Place":{"type":"object","properties":{"id":{"type":"string","description":"City id, or geo:lat,lon for an arbitrary location."},"name":{"$ref":"#/components/schemas/Localized"},"country":{"type":"string","description":"ISO 3166-1 alpha-2 code."},"lat":{"type":"number"},"lon":{"type":"number"},"official":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string","format":"uri"}},"required":["name","url"],"description":"Official air-quality source to link out to for this place."}},"required":["id","name","country","lat","lon","official"]},"SgReadings":{"type":"object","properties":{"readingAt":{"type":"string","format":"date-time","description":"Reading hour (+08:00)."},"updatedAt":{"type":"string","format":"date-time"},"stale":{"type":"boolean","description":"True when NEA could not be reached and the last good reading is shown."},"pm25OneHour":{"type":"object","properties":{"north":{"type":"number"},"south":{"type":"number"},"east":{"type":"number"},"west":{"type":"number"},"central":{"type":"number"}},"required":["north","south","east","west","central"],"description":"NEA 1-hour PM2.5 (µg/m³) by region."},"psi24h":{"type":"object","properties":{"north":{"type":"number"},"south":{"type":"number"},"east":{"type":"number"},"west":{"type":"number"},"central":{"type":"number"}},"required":["north","south","east","west","central"],"description":"NEA 24-hour PSI by region."},"pm25Sub24h":{"type":"object","properties":{"north":{"type":"number"},"south":{"type":"number"},"east":{"type":"number"},"west":{"type":"number"},"central":{"type":"number"}},"required":["north","south","east","west","central"],"description":"NEA 24-hour PM2.5 sub-index by region."},"regionPoints":{"type":"object","properties":{"north":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"}},"required":["lat","lon"]},"south":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"}},"required":["lat","lon"]},"east":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"}},"required":["lat","lon"]},"west":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"}},"required":["lat","lon"]},"central":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"}},"required":["lat","lon"]}},"required":["north","south","east","west","central"],"description":"NEA label location of each region."}},"required":["readingAt","updatedAt","pm25OneHour","psi24h","pm25Sub24h","regionPoints"]},"SgHistoryPoint":{"type":"object","properties":{"time":{"type":"string","format":"date-time"},"pm25":{"type":"object","properties":{"north":{"type":"number"},"south":{"type":"number"},"east":{"type":"number"},"west":{"type":"number"},"central":{"type":"number"}},"required":["north","south","east","west","central"],"description":"1-hour PM2.5 by region."},"psi":{"type":"object","properties":{"north":{"type":"number"},"south":{"type":"number"},"east":{"type":"number"},"west":{"type":"number"},"central":{"type":"number"}},"required":["north","south","east","west","central"],"description":"24-hour PSI by region."}},"required":["time","pm25","psi"]},"HourPoint":{"type":"object","properties":{"time":{"type":"string"},"pm25":{"type":"number"}},"required":["time","pm25"]},"Trend":{"type":"object","properties":{"history":{"type":"array","items":{"$ref":"#/components/schemas/HourPoint"}},"forecast":{"type":"array","items":{"$ref":"#/components/schemas/HourPoint"},"description":"CAMS model forecast, not official."},"direction":{"type":"string","enum":["rising","falling","steady"]},"deltaPerHour":{"type":"number"}},"required":["history","forecast","direction","deltaPerHour"]},"Modelled":{"type":"object","properties":{"pm25":{"type":"number"},"usAqi":{"type":"number"},"trend":{"$ref":"#/components/schemas/Trend"}},"required":["pm25","usAqi","trend"],"description":"CAMS model estimate via Open-Meteo. Not an official measurement."},"DoeReading":{"type":"object","properties":{"id":{"type":"string","description":"DOE station id, e.g. CA01R."},"name":{"type":"string","description":"Town, State."},"lat":{"type":"number"},"lon":{"type":"number"},"api":{"type":"integer","minimum":1,"maximum":500,"description":"Air Pollutant Index (Malay: IPU). A 24-hour index; same bands as Singapore's PSI."},"pollutant":{"type":["string","null"],"description":"Pollutant that sets the index (PM2.5, PM10, SO2, NO2, O3, CO), when DOE marks one."},"at":{"type":"string","format":"date-time","description":"Reading hour (+08:00)."},"km":{"type":"number","description":"Distance from the place to the station."},"stale":{"type":"boolean","description":"True when the reading is more than 3 hours old."},"pm25":{"type":"number","description":"Official 1-hour PM2.5 at the station (µg/m³), when DOE publishes it."},"pm25Day":{"type":"number","description":"Official 24-hour mean PM2.5 at the station (µg/m³), the figure the API is worked out from."}},"required":["id","name","lat","lon","api","pollutant","at","km","stale","pm25","pm25Day"],"description":"Official reading at the nearest Department of Environment Malaysia (APIMS) station within 25 km. Copied, may be delayed."},"Surround":{"type":"object","properties":{"north":{"type":"number"},"east":{"type":"number"},"south":{"type":"number"},"west":{"type":"number"},"km":{"type":"number"}},"required":["north","east","south","west","km"],"description":"Model PM2.5 at points about `km` north, east, south and west of the place."},"Advice":{"type":"object","properties":{"id":{"type":"string","enum":["team-sport","run","school-pe","commute","windows","laundry","outdoor-event","pets"]},"verdict":{"type":"string","enum":["go","caution","avoid"]},"title":{"$ref":"#/components/schemas/Localized"},"detail":{"$ref":"#/components/schemas/Localized"}},"required":["id","verdict","title","detail"]},"Weather":{"type":"object","properties":{"now":{"type":"object","properties":{"temp":{"type":"number"},"feels":{"type":"number"},"humidity":{"type":"number"},"precip":{"type":"number","description":"mm in the last hour"},"wind":{"type":"number","description":"km/h at 10 m"},"windDir":{"type":"number","description":"degrees the wind blows from"},"pressure":{"type":"number","description":"hPa"},"uv":{"type":"number"},"visibility":{"type":"number","description":"metres"}},"required":["temp","feels","humidity","precip","wind","windDir","pressure","uv","visibility"]},"hourly":{"type":"array","items":{"type":"object","properties":{"time":{"type":"string"},"temp":{"type":"number"},"rainProb":{"type":"number"},"wind850":{"type":"number","description":"km/h at about 1.5 km, the usual smoke-transport level"},"dir850":{"type":"number"}},"required":["time","temp","rainProb","wind850","dir850"]}},"sunrise":{"type":"string"},"sunset":{"type":"string"},"uvMax":{"type":"number"}},"required":["now","hourly","sunrise","sunset","uvMax"]},"Cause":{"type":"object","properties":{"regions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"$ref":"#/components/schemas/Localized"},"count":{"type":["integer","null"],"description":"Fire detections in the last 24 h; null when unavailable."},"prev":{"type":["integer","null"],"description":"Fire detections in the 24 h before that."},"distKm":{"type":"number"},"bearing":{"type":"number","description":"Degrees from the place towards the region."},"upwind":{"type":"boolean"}},"required":["id","name","count","prev","distKm","bearing","upwind"]}},"total":{"type":["integer","null"]},"prevTotal":{"type":["integer","null"]},"windFrom":{"type":"number"},"windSpeed":{"type":"number"},"likelyIds":{"type":"array","items":{"type":"string"}},"hasHotspotData":{"type":"boolean"},"asOf":{"type":["integer","null"],"description":"Epoch ms of the newest satellite observation."}},"required":["regions","total","prevTotal","windFrom","windSpeed","likelyIds","hasHotspotData","asOf"],"description":"Wind-direction heuristic (upwind fire regions). It says transport is likely, not proven; it is not a trajectory model."},"TimelinePoint":{"type":"object","properties":{"time":{"type":"string"},"pm25":{"type":"number"},"rainProb":{"type":"number"},"temp":{"type":"number"}},"required":["time","pm25","rainProb","temp"]},"Snapshot":{"type":"object","properties":{"place":{"$ref":"#/components/schemas/Place"},"pm25":{"type":["number","null"],"description":"1-hour PM2.5 (µg/m³) the advice is based on; null when no reading is available."},"basis":{"type":"string","enum":["official","modelled"],"description":"official = a measurement (NEA in Singapore, the nearest DOE station in Malaysia; see officialBy); modelled = CAMS model estimate, not official."},"officialBy":{"type":"string","enum":["NEA","DOE"],"description":"Who measured pm25 when basis is official. DOE: the station in `doe`."},"region":{"type":"string","enum":["north","south","east","west","central","worst"],"description":"Singapore region used for the reading."},"sg":{"$ref":"#/components/schemas/SgReadings"},"sgHistory":{"type":"array","items":{"$ref":"#/components/schemas/SgHistoryPoint"},"description":"Official hourly readings for the last 24 h (Singapore only)."},"modelled":{"$ref":"#/components/schemas/Modelled"},"surround":{"$ref":"#/components/schemas/Surround"},"advice":{"type":"array","items":{"$ref":"#/components/schemas/Advice"}},"window":{"oneOf":[{"type":"object","properties":{"start":{"type":"string"},"avg":{"type":"number"}},"required":["start","avg"]},{"type":"null"}],"description":"Cleanest upcoming 2-hour window in the model forecast."},"weather":{"$ref":"#/components/schemas/Weather"},"cause":{"$ref":"#/components/schemas/Cause"},"timeline":{"type":"array","items":{"$ref":"#/components/schemas/TimelinePoint"},"description":"Next 24 hours, starting at the official reading where there is one (see anchorMode)."},"anchorFactor":{"type":"number","description":"Official reading ÷ model reading now, clamped to 0.5–3 (1 without an official reading)."},"anchorMode":{"type":"string","enum":["scale","offset","none"],"description":"scale: model curve multiplied by anchorFactor. offset: the model reads under half the official figure, so the official level is kept and only the model's hourly change is added; low confidence. none: model curve as is."},"officialUnavailable":{"type":"boolean","description":"Singapore only: NEA is unreachable and no recent official reading exists, so pm25 is null rather than a model number."},"doe":{"$ref":"#/components/schemas/DoeReading","description":"Malaysia only: the nearest DOE station. Its API is a 24-hour index shown beside the hourly figure; when the station's fresh hourly PM2.5 is available it becomes pm25 (basis official, officialBy DOE)."},"errors":{"type":"array","items":{"type":"string"}}},"required":["place","pm25","basis","advice","window","timeline","anchorFactor","anchorMode","officialUnavailable","errors"]},"RankingRow":{"type":"object","properties":{"rank":{"type":"integer"},"id":{"type":"string","enum":["sg","kl","jb","kuching","bn","pekanbaru","palembang","jakarta","bkk","penang","ipoh","melaka","shah-alam","klang","petaling-jaya","seremban","kuantan","kota-bharu","kuala-terengganu","alor-setar","kota-kinabalu","miri","sibu","putrajaya","jambi","pontianak","palangkaraya","medan","batam","banjarmasin","balikpapan","chiang-mai","hat-yai","phuket","kangar","labuan","kluang","muar","taiping","sandakan","tawau","bintulu","dumai","padang","bengkulu","bandar-lampung","surabaya","bandung","semarang","makassar","manado","denpasar","yogyakarta","samarinda","palu","pangkal-pinang","chiang-rai","khon-kaen","pattaya","nakhon-ratchasima","phitsanulok","surat-thani","hanoi","ho-chi-minh-city","da-nang","hai-phong","can-tho","manila","cebu","davao","baguio","phnom-penh","siem-reap","vientiane","luang-prabang","yangon","mandalay","naypyidaw","dili"]},"name":{"type":"string"},"names":{"$ref":"#/components/schemas/Localized"},"country":{"type":"string"},"lat":{"type":"number"},"lon":{"type":"number"},"pm25":{"type":"number"},"band":{"type":"string","enum":["normal","elevated","high","very-high"],"description":"NEA 1-hour PM2.5 band."},"basis":{"type":"string","enum":["official","modelled"]},"officialBy":{"type":"string","enum":["NEA","DOE"],"description":"Who measured an official row: NEA (Singapore) or the nearest DOE station (Malaysia)."}},"required":["rank","id","name","names","country","lat","lon","pm25","band","basis","officialBy"]},"Ranking":{"type":"object","properties":{"generatedAt":{"type":"string","format":"date-time"},"note":{"type":"string"},"officialAt":{"type":["string","null"]},"modelAt":{"type":["string","null"]},"singaporeUnavailable":{"type":"boolean"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/RankingRow"}}},"required":["generatedAt","note","officialAt","modelAt","singaporeUnavailable","rows"]},"MapGrid":{"type":"object","properties":{"lat0":{"type":"number","description":"South edge (first row)."},"lon0":{"type":"number","description":"West edge (first column)."},"step":{"type":"number","description":"Degrees between grid points."},"rows":{"type":"integer"},"cols":{"type":"integer"},"times":{"type":"array","items":{"type":"string","format":"date-time"},"description":"Hourly UTC times from 12 h ago to 24 h ahead."},"nowIdx":{"type":"integer"},"pm25":{"type":"array","items":{"type":"array","items":{"type":"number"}},"description":"pm25[t][row * cols + col], CAMS model values (not official)."},"wind":{"type":"object","properties":{"rows":{"type":"integer"},"cols":{"type":"integer"},"speed":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"dir":{"type":"array","items":{"type":"array","items":{"type":"number"}}}},"required":["rows","cols","speed","dir"],"description":"850 hPa wind on every second grid point: km/h and degrees the wind blows from."}},"required":["lat0","lon0","step","rows","cols","times","nowIdx","pm25","wind"]},"Hotspots":{"type":"object","properties":{"enabled":{"type":"boolean"},"asOf":{"type":["integer","null"],"description":"Epoch ms of the newest satellite pass."},"points":{"type":"array","items":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"},{"type":"number"}],"minItems":3,"maxItems":3},"description":"[lat, lon, fire radiative power (MW)] for VIIRS detections in the 24 h before asOf."},"error":{"type":"string"}},"required":["enabled","asOf","points"]},"NewsCluster":{"type":"object","properties":{"id":{"type":"string"},"lang":{"type":"string","enum":["en","zh","ms","id"]},"title":{"type":"string"},"link":{"type":"string","format":"uri"},"at":{"type":"integer","description":"Epoch ms."},"source":{"type":"string"},"snippet":{"type":"string"},"region":{"type":"string","enum":["SG","MY","ID","TH","REGION"]},"topics":{"type":"array","items":{"type":"string","enum":["conditions","policy","health","schools","events","cause"]}},"official":{"type":"boolean"},"others":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"link":{"type":"string","format":"uri"},"title":{"type":"string"}},"required":["source","link","title"]},"description":"Other outlets that covered the same story."}},"required":["id","lang","title","link","at","source","snippet","region","topics","official","others"]},"News":{"type":"object","properties":{"updatedAt":{"type":"integer","description":"Epoch ms."},"count":{"type":"integer"},"clusters":{"type":"array","items":{"$ref":"#/components/schemas/NewsCluster"}},"errors":{"type":"array","items":{"type":"string"}}},"required":["updatedAt","count","clusters","errors"]}}}}