Sunsethue logo

Sunsethue API

Build with sunrise and sunset quality forecasts, more than just sunrise and sunset times.

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.

DOCS

Start building in minutes

Get free daily credits for development, then scale with pay-as-you-go when you launch commercially. Free forever for hobby and personal projects.

Example Request & Response

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"
      ]
    }
  }
}

What data does the API provide?

  • Sunrise and sunset quality forecasts
  • Cloud cover at sunrise or sunset
  • Time and direction of sunrise and sunset
  • Golden and blue hour times

Key Benefits

  • Accurate sunrise and sunset forecasts based on the ray-based Sunsethue model
  • Four daily updates of the forecasts
  • Global coverage: available for all locations worldwide
  • Easy to integrate in any project
READ THE WHITEPAPER

Use Cases

Weather apps and websites

Go beyond sunrise and sunset times and basic cloud-cover metrics with daily quality forecasts.

  • Show a “sunset quality today” card in your forecast feed
  • Send push alerts when high-quality sunsets are expected

Photography apps and websites

Help outdoor photographers plan sessions around expected quality and the exact golden/blue hour windows.

  • Inform photographers about the expected quality of upcoming sunrises and sunsets
  • Not every golden hour is the same, the sunset quality metric can help photographers plan ahead

Tourism

Promote local viewpoints and sunset events using quality forecasts visitors can trust.

  • Feature top sunset spots with daily quality highlights
  • Increase visitors to local sunset viewing locations when conditions are forecasted to be perfect

Smart home integrations

Trigger scenes and automations based on both timing and expected sky quality.

  • Adjust outdoor lighting around blue hour start/end
  • Set your morning alarm based on expected sunrise quality

Coming from SunsetWX?

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.

SunsethueSunsetWX
MethodologyRay-based methodLocal grid-cell method
Forecast horizon3 days4 days
Reliability>99.9% uptimeMultiple failures last year
MaintenanceRegular improvements and updatesNo changes since 2021
Used bySolarwatch, Sunsethue web-appAlpenglow

Important things when switching from SunsetWX to Sunsethue:

  • Even though both APIs provide a score between 0% and 100%, the interpretation and distribution of the score may be different.
  • Since the resolution and update times of the forecasts are different, your caching strategy may need to be adjusted.

If you need help with migrating from SunsetWX to Sunsethue, do not hesitate to contact me.

FAQ

What makes Sunsethue different from a normal sunrise/sunset API?

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.

How accurate are the forecasts?

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.

Is there a free tier for testing?

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.

How do I increase my daily quota or upgrade to pay-as-you-go?

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.

Can I cache the forecasts?

The forecasts update every 6 hours, between these updates the forecasts can be cached per location (grid cell).

MORE GENERAL QUESTIONS

Free

Best for personal and hobby projects.

  • Access to all endpoints
  • Available worldwide
  • 1000 credits per day
  • No commercial use
SIGN UP

Pay as you go

For commercial apps that need scalable access and production usage.

  • €1 per 10,000 credits (~2,000 sunsets)
  • 30,000 free credits per month
  • Start for free by signing up below
  • No cost during development
  • Set your own daily maximum quota
  • Commercial use allowed

Widgets

If 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