The Sunsethue API is an easy to use API for developers who need reliable sunrise and sunset forecasts worldwide. Alongside timing data, you get a forecasted quality score that indicates how good a sunrise or sunset is expected to be.
Powered by Sunsethue’s ray-based model, the API also returns cloud cover, direction, and golden/blue hour windows so you can create smarter weather products, photography tools, notifications, and tourism information.
If your product already has sunrise and/or sunset times, Sunsethue adds the missing layer: sunset and sunrise quality forecasting for better user decisions.
DOCSGet free daily credits for development, then scale with pay-as-you-go when you launch commercially. Free forever for hobby and personal projects.
Query the event endpoint for a specific location, date, and event type. The response includes the quality metric and supporting fields needed to explain and act on the forecast.
https://api.sunsethue.com/event?latitude=41.4&longitude=2.2&date=2026-02-22&type=sunset
{
"time": "2026-02-22T20:23:23.349Z",
"location": {
"latitude": 41.4,
"longitude": 2.2
},
"grid_location": {
"latitude": 41.5,
"longitude": 2
},
"data": {
"type": "sunset",
"model_data": true,
"quality": 0.45,
"cloud_cover": 0.32,
"quality_text": "Good",
"time": "2026-02-22T17:32:00.000Z",
"direction": 256.7,
"magics": {
"blue_hour": [
"2026-02-22T17:55:00.000Z",
"2026-02-22T18:07:00.000Z"
],
"golden_hour": [
"2026-02-22T17:17:00.000Z",
"2026-02-22T17:49:00.000Z"
]
}
}
}Go beyond sunrise and sunset times and basic cloud-cover metrics with daily quality forecasts.
Help outdoor photographers plan sessions around expected quality and the exact golden/blue hour windows.
Promote local viewpoints and sunset events using quality forecasts visitors can trust.
Trigger scenes and automations based on both timing and expected sky quality.
Since SunsetWX is not actively being maintained and has had multiple outages in the past year, many developers are looking for a reliable alternative. Sunsethue's API provides the same core data as SunsetWX but with a more accurate ray-based model, higher reliability, and regular improvements.
| Sunsethue | SunsetWX | |
|---|---|---|
| Methodology | Ray-based method | Local grid-cell method |
| Forecast horizon | 3 days | 4 days |
| Reliability | >99.9% uptime | Multiple failures last year |
| Maintenance | Regular improvements and updates | No changes since 2021 |
Important things when switching from SunsetWX to Sunsethue:
If you need help with migrating from SunsetWX to Sunsethue, do not hesitate to contact me.
Sunsethue adds a forecasted quality metric so you can estimate how visually strong a sunrise or sunset is expected to be, not just when it happens. This is often very useful since not every sunrise or sunset is equal.
Due to the ray-based approach, the accuracy is higher than the conventional local grid-cell approach. Weather forecasts are always at least somewhat uncertain, so the forecasts may be wrong if the underlying weather model is wrong.
Yes, during development and testing, you do not have to pay for the credits you use. Just send me an email to have your quota increased.
Please contact me by mail so I can move you over to the pay-as-you-go plan, any questions are of course also welcome.
The forecasts update every 6 hours, between these updates the forecasts can be cached per location (grid cell).
MORE GENERAL QUESTIONSBest for personal and hobby projects.
You can use your API key to operate the following integrations made by Sunsethue users. These are not created, nor operated by Sunsethue, so do your own due diligence when using them. If you've got integrations to share with the community, send me an email!
By Andrew Ryder
Sunsethue Helper checks sunrise and sunset photo-quality forecasts for the places you care about, and can notify you via email, browser push, webhook, and Pushover when conditions look good. It is a private, single-user tool — not a multi-tenant product.
https://github.com/andrewtryder/sunsethue-helperBy Andrew Ryder
Sunsethue adds sunrise and sunset quality forecasts to Home Assistant using the SunsetHue developer API. It provides quality scores, cloud cover, event direction, event time, and blue/golden-hour information for up to three local dates.
https://github.com/andrewtryder/ha-sunsethueBy Yorks0n
An app for Pebble watches that shows detailed timing information and the sunrise/sunset quality for upcoming sunrises and sunset for your preferred location.
https://apps.repebble.com/a32e0cb46c41426b8cd06df7By Andrew Ryder
Unofficial native macOS app (and optional WidgetKit extension) that shows Sunsethue sunrise and sunset forecast quality for one or more saved locations.
https://github.com/andrewtryder/sunsethue-macosIf you do not want to write your own code, you can include Sunsethue's forecast on your website using Sunsethue Widgets. You can generate widgets for any location for free.
USE WIDGETS© 2026 - Sunsethue (v0.11.0-beta)
-
Made in Europe