{"openapi":"3.1.0","info":{"title":"NEO Weather API","version":"1.0.0","description":"Cloudflare Worker weather API backed by Open-Meteo, GeoNames and Copernicus CAMS. Supports city names, postal codes, coordinates, JSON POST, JSON, text and CSV output."},"servers":[{"url":"https://weather.neobeacon.cc"}],"paths":{"/api/weather":{"get":{"summary":"Get weather by city, postal code, coordinates or edge location","parameters":[{"name":"city","in":"query","schema":{"type":"string","maxLength":100},"description":"City name or postal code"},{"name":"lat","in":"query","schema":{"type":"number","minimum":-90,"maximum":90}},{"name":"lon","in":"query","schema":{"type":"number","minimum":-180,"maximum":180}},{"name":"label","in":"query","schema":{"type":"string","maxLength":80}},{"name":"lang","in":"query","schema":{"type":"string","enum":["zh","en"],"default":"zh"}},{"name":"unit","in":"query","schema":{"type":"string","enum":["metric","imperial"],"default":"metric"}},{"name":"format","in":"query","schema":{"type":"string","enum":["json","text","csv"],"default":"json"}}],"responses":{"200":{"description":"Current conditions, 24-hour and 7-day forecasts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Weather"}},"text/plain":{"schema":{"type":"string"}},"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Get weather using a JSON request","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"city":{"type":"string","maxLength":100},"lat":{"type":"number"},"lon":{"type":"number"},"label":{"type":"string","maxLength":80},"lang":{"type":"string","enum":["zh","en"]},"unit":{"type":"string","enum":["metric","imperial"]},"format":{"type":"string","enum":["json","text","csv"]}}}}}},"responses":{"200":{"description":"Weather response"},"400":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"}}}},"/api/weather/{city}":{"get":{"summary":"Get weather using a city in the URL path","parameters":[{"name":"city","in":"path","required":true,"schema":{"type":"string"}},{"name":"lang","in":"query","schema":{"type":"string","enum":["zh","en"]}},{"name":"unit","in":"query","schema":{"type":"string","enum":["metric","imperial"]}}],"responses":{"200":{"description":"Weather response"}}}},"/api/locations":{"get":{"summary":"Search cities and postal codes","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2}},{"name":"lang","in":"query","schema":{"type":"string","enum":["zh","en"]}},{"name":"count","in":"query","schema":{"type":"integer","minimum":1,"maximum":10}}],"responses":{"200":{"description":"Matching locations"}}}},"/api/location/ip":{"get":{"summary":"Resolve the requesting network to a city-level approximate location","description":"Uses Cloudflare edge geolocation plus independent IP databases and returns no raw client IP. Results are for rough startup positioning before browser GPS is attempted.","responses":{"200":{"description":"Consensus city-level IP location"},"503":{"$ref":"#/components/responses/Error"}}}},"/health":{"get":{"summary":"Service health","responses":{"200":{"description":"Worker is running"}}}},"/api/connection":{"get":{"summary":"Inspect the protocol negotiated with the Cloudflare edge","responses":{"200":{"description":"HTTP protocol, QUIC RTT, TLS and edge metadata"}}}}},"components":{"schemas":{"Weather":{"type":"object","required":["location","current","hourly","daily","units","sources"],"properties":{"location":{"type":"object"},"current":{"type":"object"},"hourly":{"type":"array","items":{"type":"object"}},"daily":{"type":"array","items":{"type":"object"}},"air_quality":{"type":["object","null"]},"units":{"type":"object"},"meta":{"type":"object"},"sources":{"type":"array","items":{"type":"object"}}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}},"responses":{"Error":{"description":"Structured error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}