{"openapi":"3.1.0","info":{"title":"Field Window","version":"1.0.0","description":"Find contiguous hours that meet precipitation, wind and temperature limits at a US location, with weather alerts from the US National Weather Service."},"servers":[{"url":"https://field-window-terms-7c3f.rafaelantunes137.workers.dev"}],"paths":{"/api/windows":{"get":{"operationId":"getFieldWindows","summary":"Find contiguous hours that meet precipitation, wind and temperature limits at a US location, with weather alerts from the US National Weather Service.","description":"An empty query uses the Washington, DC demonstration location. Custom queries must include lat and lon.","x-x402":{"scheme":"exact","network":"eip155:8453","asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","amount":"10000"},"parameters":[{"name":"lat","in":"query","required":false,"schema":{"type":"number","minimum":-90,"maximum":90,"description":"Latitude in NWS coverage."}},{"name":"lon","in":"query","required":false,"schema":{"type":"number","minimum":-180,"maximum":180,"description":"Longitude in NWS coverage."}},{"name":"hours","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":48,"default":24}},{"name":"minHours","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":48,"description":"Defaults to 2 or the requested horizon when shorter."}},{"name":"maxRainPct","in":"query","required":false,"schema":{"type":"number","minimum":0,"maximum":100,"default":20}},{"name":"maxWindMph","in":"query","required":false,"schema":{"type":"number","minimum":0,"maximum":150,"default":15}},{"name":"maxGustMph","in":"query","required":false,"schema":{"type":"number","minimum":0,"maximum":200,"description":"Optional gust limit; hours missing gust data are excluded."}},{"name":"minTempF","in":"query","required":false,"schema":{"type":"number","minimum":-100,"maximum":160,"default":40}},{"name":"maxTempF","in":"query","required":false,"schema":{"type":"number","minimum":-100,"maximum":160,"default":95}}],"responses":{"200":{"description":"Forecast report with x402 settlement receipt header","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","maxLength":18,"enum":["nws-weather-window"]},"location":{"type":"object","properties":{"lat":{"type":"string","maxLength":8},"lon":{"type":"string","maxLength":9},"city":{"type":"string","maxLength":64},"state":{"type":"string","maxLength":2},"grid":{"type":"string","maxLength":36},"timeZone":{"type":"string","maxLength":64}},"required":["lat","lon","state","grid"],"additionalProperties":false},"issuedAt":{"type":"string","maxLength":24},"evaluatedAt":{"type":"string","maxLength":24},"criteria":{"type":"object","properties":{"lat":{"type":"string","maxLength":8},"lon":{"type":"string","maxLength":9},"hours":{"type":"integer","minimum":1,"maximum":48},"minHours":{"type":"integer","minimum":1,"maximum":48},"maxRainPct":{"type":"number","minimum":0,"maximum":100},"maxWindMph":{"type":"number","minimum":0},"maxGustMph":{"type":"number","minimum":0},"minTempF":{"type":"number"},"maxTempF":{"type":"number"}},"required":["lat","lon","hours","minHours","maxRainPct","maxWindMph","minTempF","maxTempF"],"additionalProperties":false},"coverage":{"type":"object","properties":{"checkedHours":{"type":"integer","minimum":0,"maximum":48},"missingHours":{"type":"integer","minimum":0,"maximum":48},"blockedHours":{"type":"integer","minimum":0,"maximum":48},"hasNwsAlerts":{"type":"boolean","description":"An active NWS alert overlaps the requested forecast horizon."},"alertCount":{"type":"integer","minimum":0},"windowCount":{"type":"integer","minimum":0},"alertsTruncated":{"type":"boolean"},"windowsTruncated":{"type":"boolean"},"locationTruncated":{"type":"boolean"},"sourcesTruncated":{"type":"boolean"}},"required":["checkedHours","missingHours","blockedHours","hasNwsAlerts","alertCount","windowCount","alertsTruncated","windowsTruncated","locationTruncated","sourcesTruncated"],"additionalProperties":false},"windows":{"type":"array","items":{"type":"object","properties":{"startUtc":{"type":"string","maxLength":24},"endUtc":{"type":"string","maxLength":24},"hours":{"type":"integer","minimum":1,"maximum":48},"maxRainPct":{"type":"number","minimum":0,"maximum":100},"maxWindMph":{"type":"number","minimum":0},"maxGustMph":{"type":"number","minimum":0},"minTempF":{"type":"number"},"maxTempF":{"type":"number"}},"required":["startUtc","endUtc","hours","maxRainPct","maxWindMph","minTempF","maxTempF"],"additionalProperties":false},"maxItems":24},"alerts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":160},"event":{"type":"string","maxLength":80},"severity":{"type":"string","maxLength":24},"headline":{"type":"string","maxLength":120},"startUtc":{"type":"string","maxLength":24},"endUtc":{"type":"string","maxLength":24}},"required":["event","startUtc","endUtc"],"additionalProperties":false},"maxItems":4},"sources":{"type":"array","items":{"type":"string","maxLength":128},"maxItems":4},"note":{"type":"string","maxLength":100}},"required":["kind","location","issuedAt","evaluatedAt","criteria","coverage","windows","alerts","sources","note"],"additionalProperties":false},"examples":{"capturedWashington":{"summary":"Washington, DC forecast captured from /sample at 2026-11-28T23:06:37.585Z","description":"Historical example. Use /sample for the current forecast.","value":{"kind":"nws-weather-window","location":{"lat":"38.9072","lon":"-77.0369","state":"DC","grid":"LWX/96,72","city":"Washington","timeZone":"America/New_York"},"issuedAt":"2026-11-28T20:53:06.000Z","evaluatedAt":"2026-11-28T23:06:37.585Z","criteria":{"lat":"38.9072","lon":"-77.0369","hours":24,"minHours":2,"maxRainPct":20,"maxWindMph":15,"minTempF":40,"maxTempF":95},"coverage":{"checkedHours":23,"missingHours":0,"blockedHours":0,"hasNwsAlerts":false,"alertCount":0,"windowCount":2,"alertsTruncated":false,"windowsTruncated":false,"locationTruncated":false,"sourcesTruncated":false},"windows":[{"startUtc":"2026-11-29T00:00:00.000Z","endUtc":"2026-11-29T09:00:00.000Z","hours":9,"maxRainPct":0,"maxWindMph":6,"minTempF":40,"maxTempF":48},{"startUtc":"2026-11-29T13:00:00.000Z","endUtc":"2026-11-29T23:00:00.000Z","hours":10,"maxRainPct":0,"maxWindMph":10,"minTempF":40,"maxTempF":58}],"alerts":[],"sources":["https://api.weather.gov/points/38.9072,-77.0369","https://api.weather.gov/gridpoints/LWX/96,72/forecast/hourly","https://api.weather.gov/alerts/active?point=38.9072,-77.0369"],"note":"Forecast screening against the supplied limits. Conditions and alerts can change."}}}}},"headers":{"Payment-Response":{"description":"x402 settlement response encoded as base64 JSON.","schema":{"type":"string"}}}},"400":{"description":"Invalid input"},"402":{"description":"Exact Base USDC payment required","headers":{"Payment-Required":{"schema":{"type":"string"}}}},"503":{"description":"Forecast unavailable"}}}},"/sample":{"get":{"operationId":"getExample","responses":{"200":{"description":"Free Washington, DC sample","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","maxLength":18,"enum":["nws-weather-window"]},"location":{"type":"object","properties":{"lat":{"type":"string","maxLength":8},"lon":{"type":"string","maxLength":9},"city":{"type":"string","maxLength":64},"state":{"type":"string","maxLength":2},"grid":{"type":"string","maxLength":36},"timeZone":{"type":"string","maxLength":64}},"required":["lat","lon","state","grid"],"additionalProperties":false},"issuedAt":{"type":"string","maxLength":24},"evaluatedAt":{"type":"string","maxLength":24},"criteria":{"type":"object","properties":{"lat":{"type":"string","maxLength":8},"lon":{"type":"string","maxLength":9},"hours":{"type":"integer","minimum":1,"maximum":48},"minHours":{"type":"integer","minimum":1,"maximum":48},"maxRainPct":{"type":"number","minimum":0,"maximum":100},"maxWindMph":{"type":"number","minimum":0},"maxGustMph":{"type":"number","minimum":0},"minTempF":{"type":"number"},"maxTempF":{"type":"number"}},"required":["lat","lon","hours","minHours","maxRainPct","maxWindMph","minTempF","maxTempF"],"additionalProperties":false},"coverage":{"type":"object","properties":{"checkedHours":{"type":"integer","minimum":0,"maximum":48},"missingHours":{"type":"integer","minimum":0,"maximum":48},"blockedHours":{"type":"integer","minimum":0,"maximum":48},"hasNwsAlerts":{"type":"boolean","description":"An active NWS alert overlaps the requested forecast horizon."},"alertCount":{"type":"integer","minimum":0},"windowCount":{"type":"integer","minimum":0},"alertsTruncated":{"type":"boolean"},"windowsTruncated":{"type":"boolean"},"locationTruncated":{"type":"boolean"},"sourcesTruncated":{"type":"boolean"}},"required":["checkedHours","missingHours","blockedHours","hasNwsAlerts","alertCount","windowCount","alertsTruncated","windowsTruncated","locationTruncated","sourcesTruncated"],"additionalProperties":false},"windows":{"type":"array","items":{"type":"object","properties":{"startUtc":{"type":"string","maxLength":24},"endUtc":{"type":"string","maxLength":24},"hours":{"type":"integer","minimum":1,"maximum":48},"maxRainPct":{"type":"number","minimum":0,"maximum":100},"maxWindMph":{"type":"number","minimum":0},"maxGustMph":{"type":"number","minimum":0},"minTempF":{"type":"number"},"maxTempF":{"type":"number"}},"required":["startUtc","endUtc","hours","maxRainPct","maxWindMph","minTempF","maxTempF"],"additionalProperties":false},"maxItems":24},"alerts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","maxLength":160},"event":{"type":"string","maxLength":80},"severity":{"type":"string","maxLength":24},"headline":{"type":"string","maxLength":120},"startUtc":{"type":"string","maxLength":24},"endUtc":{"type":"string","maxLength":24}},"required":["event","startUtc","endUtc"],"additionalProperties":false},"maxItems":4},"sources":{"type":"array","items":{"type":"string","maxLength":128},"maxItems":4},"note":{"type":"string","maxLength":100}},"required":["kind","location","issuedAt","evaluatedAt","criteria","coverage","windows","alerts","sources","note"],"additionalProperties":false},"examples":{"capturedWashington":{"summary":"Washington, DC forecast captured from /sample at 2026-11-28T23:06:37.585Z","description":"Historical example. Use /sample for the current forecast.","value":{"kind":"nws-weather-window","location":{"lat":"38.9072","lon":"-77.0369","state":"DC","grid":"LWX/96,72","city":"Washington","timeZone":"America/New_York"},"issuedAt":"2026-11-28T20:53:06.000Z","evaluatedAt":"2026-11-28T23:06:37.585Z","criteria":{"lat":"38.9072","lon":"-77.0369","hours":24,"minHours":2,"maxRainPct":20,"maxWindMph":15,"minTempF":40,"maxTempF":95},"coverage":{"checkedHours":23,"missingHours":0,"blockedHours":0,"hasNwsAlerts":false,"alertCount":0,"windowCount":2,"alertsTruncated":false,"windowsTruncated":false,"locationTruncated":false,"sourcesTruncated":false},"windows":[{"startUtc":"2026-11-29T00:00:00.000Z","endUtc":"2026-11-29T09:00:00.000Z","hours":9,"maxRainPct":0,"maxWindMph":6,"minTempF":40,"maxTempF":48},{"startUtc":"2026-11-29T13:00:00.000Z","endUtc":"2026-11-29T23:00:00.000Z","hours":10,"maxRainPct":0,"maxWindMph":10,"minTempF":40,"maxTempF":58}],"alerts":[],"sources":["https://api.weather.gov/points/38.9072,-77.0369","https://api.weather.gov/gridpoints/LWX/96,72/forecast/hourly","https://api.weather.gov/alerts/active?point=38.9072,-77.0369"],"note":"Forecast screening against the supplied limits. Conditions and alerts can change."}}}}}}}}}}}