Community. Driven. Weather. Data.Always Ad-FreeDeveloper FriendlyChecking statusDiscord
Become a supporter
Sign in

Sunrise and sunset outlook

Every sunrise and sunset of the next five days at a point, scored twice, for a colourful sky and for a clear view of the sun.


Base URL: https://api.wxalerts.org

How good each coming sunrise and sunset will look at a point, from the same forecast that drives the wxalerts.org sunrise and sunset notifications. Every event gets two scores from 0 to 100: one for colour in the sky, one for whether the sun’s own disc will be visible down to the horizon.

No key needed. Browsers block calls from other websites (CORS allows only wxalerts.org), so call it from a server, script or app. Responses carry Cache-Control: public, max-age=900: scores are kept for a quarter of an hour, and a new model hour lands about hourly. Limits are on the overview.

There is no place name or location_id form, only lat and lon. A missing or out of range coordinate is a 422.

How the two scores are built is in How the sunrise and sunset scores work.

Response notes

  • lat and lon are the centre of the NBM forecast cell that was scored, not the point you asked for. Everyone asking about the same town reads the same cell.
  • When available is false, horizon_days stays 5.
  • sky_alerts is currently true for co, ak and pr.
  • Categories (poor, fair, good, great) are the same for both scores.

Confidence

Each event is scored from the first source that has data for it and is within its lead:

source used to confidence
HRRR cloud layers 6 hours lead (to 48 if no NBM data is on hand) high to 6 hours, medium to 18, low beyond
NBM cloud layers (lower 48 only) 36 hours lead high
NBM total cloud the rest of the horizon medium to 60 hours, low beyond

Both NBM sources report as NBM in source. Total cloud is placed low or high by the forecast ceiling; where there is no ceiling, which is most of the horizon past three and a half days, confidence is low. A light path that is mostly unknown (it runs off the grid, as it does out to sea from Guam and Puerto Rico) costs one level.

The best event

best_colour and best_clear pick the highest score after weighting by confidence (high 1.0, medium 0.85, low 0.7), so a day four guess at 90 does not outrank a confident 75. Ties go to the sooner event. Nothing scoring below 25 is picked.

Coverage

Anywhere inside one of the five NBM domains. Outside the lower 48 there is only NBM total cloud, no smoke or aerosol and no terrain, so an event there is medium confidence at best. A point outside every grid returns "available": false.

GET /sky/outlook

Every sunrise and sunset of the coming days at a point, scored.

Access. Anonymous, or an API key holding weather:read. Also served at /v1/sky/outlook, where a key (or the app or website sign-in) is required. Anonymous requests share the per-address limit, and a request with a key is charged to the key. See Rate limits.

How good each coming sunrise and sunset will look at a point, from the same forecast that drives the wxalerts.org sunrise and sunset notifications. Every event gets two scores from 0 to 100: one for colour in the sky, one for whether the sun’s own disc will be visible down to the horizon. Confidence falls with lead time, and the best event for each score is marked. Scores are kept for a quarter of an hour. A point outside every forecast grid answers 200 with available false.

Parameters

Name In Type Required Default Bounds Description
lat query number yes none -90 to 90 Latitude in degrees north, -90 to 90
lon query number yes none -180 to 180 Longitude in degrees east, -180 to 180

Response

Returns object.

Field Type Description
available boolean False when the point is outside every forecast grid. The other fields are then null, empty or false, still with a 200.
lat number or null Latitude of the center of the forecast cell that was scored, not the point asked about.
lon number or null Longitude of the center of the forecast cell that was scored, not the point asked about.
time_zone string or null The point’s own IANA time zone.
today string or null Today’s date at the point, YYYY-MM-DD, so a client elsewhere can say ‘today’ and ‘tomorrow’ by the place’s calendar.
domain string or null The forecast domain: co (the lower 48 and the edges of Canada and Mexico), ak, hi, pr (with the Virgin Islands) or gu (with the Northern Marianas). Outside co there is only total cloud and no terrain, so confidence is medium at best.
sky_alerts boolean Whether wxalerts.org sends sunrise and sunset notifications for a place saved here. Hawaii and Guam are scored but not alerted.
horizon_days integer How many days are covered: today and the next four, by the place’s calendar.
events array of object Every sunrise and sunset still ahead in the horizon, soonest first. One that has already happened today is not listed.
events[].kind string sunrise or sunset.
events[].local_date string The date of the event at the point, YYYY-MM-DD.
events[].event_time string (date-time) The instant of the event, UTC.
events[].event_clock string The same instant on the place’s own clock, ready to show, e.g. ‘5:47 PM CST’.
events[].score number or null The colour score from 0 to 100: whether the low sun will light up cloud from below. Null when the event could not be scored.
events[].category string or null The colour score’s category: poor (below 25), fair (25 to below 50), good (50 to below 75) or great (75 and up).
events[].confidence string or null high, medium or low, from the forecast source and its lead time.
events[].reasons array of string Plain words for what made the colour score, best first.
events[].clear_score number or null The clear sun score from 0 to 100: whether the sun’s own disc will be visible down to the horizon. A cloudless sky is its best case, which the colour score rates poor by design.
events[].clear_category string or null The clear sun score’s category, on the same scale as category.
events[].clear_reasons array of string Plain words for what made the clear sun score. Can be empty.
events[].source string or null HRRR or NBM, the model whose cloud the event was scored from.
events[].lead_hours number or null Hours from that model’s run to the event.
events[].best_colour boolean True for the one event most worth going out for on the colour score, after weighting by confidence. At most one event is true, and none when nothing reaches fair.
events[].best_clear boolean The same for the clear sun score. At most one event is true, and none when nothing reaches fair.
no_events array of object Days with no sunrise or no sunset at all, so a page can say so rather than leave a gap. Empty everywhere but the far north.
no_events[].kind string sunrise or sunset, whichever does not happen.
no_events[].local_date string The date at the point, YYYY-MM-DD.
no_events[].reason string polar_night (the sun stays down) or polar_day (it stays up).
{
  "available": true,
  "domain": "co",
  "events": [
    {
      "best_clear": false,
      "best_colour": true,
      "category": "great",
      "clear_category": "fair",
      "clear_reasons": [
        "cloud along the sun's path may hide it"
      ],
      "clear_score": 44.5,
      "confidence": "high",
      "event_clock": "5:28 PM CST",
      "event_time": "2026-11-09T23:28:41.527566Z",
      "kind": "sunset",
      "lead_hours": 6.5,
      "local_date": "2026-11-09",
      "reasons": [
        "broken mid and high cloud to catch the colour",
        "a clear horizon toward the sun"
      ],
      "score": 79,
      "source": "NBM"
    }
  ],
  "horizon_days": 5,
  "lat": 35.208,
  "lon": -97.365,
  "no_events": [],
  "sky_alerts": true,
  "time_zone": "America/Chicago",
  "today": "2026-11-09"
}

Errors

Status Meaning
422 A parameter is missing, malformed or out of range. detail lists which.

Plus the common errors every route can return (400 key_in_query, 401, 403, 429, 500).

Caching and limits

Cache-Control: public, max-age=900; under /v1 it is private, max-age=900. Scores are kept for 15 minutes in each replica. No ETag. A point outside every forecast grid is 200 with available: false, not an error.

View this page as Markdown

May we use Microsoft Clarity to see how pages are used (clicks, scrolling and replays of a visit, with anything you type hidden), plus a random ID linking that to crash reports? Only to find bugs and confusing screens. Never advertising, never sold.