❄️
Snow Status API
Real-time snow conditions and 7-day forecasts for Flagstaff & Sedona, AZ
GET /api/status
Returns cached snow status for both cities. Fast response, no external API calls.
{
"lastCheckedAt": "2026-01-14T22:23:33.470Z",
"flagstaff": {
"isSnowing": false,
"lastChangedAt": "2026-01-14T06:00:00.000Z",
"lastCheckedAt": "2026-01-14T22:23:33.470Z",
"snowForecast": {
"expectedDate": "2026-01-18",
"daysAway": 4,
"snowfallCm": 2.5
}
},
"sedona": {
"isSnowing": true,
"lastChangedAt": "2026-01-14T20:00:00.000Z",
"lastCheckedAt": "2026-01-14T22:23:33.470Z",
"snowForecast": null
}
}POST /api/subscribe
Subscribe an email to receive snow alerts. Rate limited to 5 requests/minute per IP.
{
"email": "user@example.com",
"cities": ["flagstaff", "sedona"] // optional, defaults to both
}{ "ok": true }Note: Response is always the same to prevent email enumeration.
GET /api/unsubscribe
One-click unsubscribe from email alerts. Returns an HTML confirmation page.
| Param | Type | Description |
|---|---|---|
token | string (UUID) | Unsubscribe token from email |
GET /api/unsubscribe?token=550e8400-e29b-41d4-a716-446655440000
GET /api/force-check
Force a fresh weather check. Fetches live data from Open-Meteo, updates database, and sends alerts if conditions changed.
| Param | Type | Description |
|---|---|---|
secret | string | CRON_SECRET env var value |
{
"runId": "x5dnm3zu",
"timestamp": "2026-01-14T22:23:33.470Z",
"provider": "open-meteo",
"latencyMs": 608,
"results": [
{
"city": "Flagstaff, AZ",
"isSnowing": false,
"weatherCode": 3,
"temperature": 11.3,
"previousState": false,
"stateChanged": false,
"emailsSent": 0,
"forecast": {
"snowExpected": true,
"nextSnowDate": "2026-01-18",
"daysAway": 4,
"forecastAlertSent": true
}
},
{
"city": "Sedona, AZ",
"isSnowing": false,
"weatherCode": 0,
"temperature": 19,
"previousState": false,
"stateChanged": false,
"emailsSent": 0,
"forecast": {
"snowExpected": false,
"nextSnowDate": null,
"daysAway": null,
"forecastAlertSent": false
}
}
]
}POST /api/cron/check-snow
Scheduled weather check (called by Vercel Cron daily at 8 AM UTC). Same as force-check but respects month gate (Dec-Mar only).
x-cron-secret header or secret query param{
"skipped": true,
"reason": "Outside allowed months (current: 7, allowed: [12, 1, 2, 3])"
}Weather Codes Reference
WMO Weather Codes from Open-Meteo. Snow conditions:
| Code | Condition |
|---|---|
| 0 | Clear sky |
| 1-3 | Partly cloudy / Overcast |
| 71 | Slight snow fall |
| 73 | Moderate snow fall |
| 75 | Heavy snow fall |
| 77 | Snow grains |
| 85 | Slight snow showers |
| 86 | Heavy snow showers |
Email Notifications
Subscribers receive two types of alerts:
1. Snow Alert (when it starts snowing)
Subject: ❄️ IT IS SNOWING IN FLAGSTAFF
2. Forecast Alert (when snow appears in 7-day forecast)
Subject: 🌨️ SNOW COMING TO FLAGSTAFF IN 3 DAYS