Sunset and sunrise times for a given latitude and longitude.
Sunrise and Sunset API is a free Science & Math API that requires no API key, is served over HTTPS and does not support CORS, so it should be called from a server.
API v2: sunrise, sunset, twilight, golden hour and solar position for any location, with automatic local timezone, ISO 8601 times and date ranges.
Details from sunrise-sunset.org.

Unified API suite · now live
Geocode an address, validate an email, track a flight or pull stock data with one account, one dashboard and one API key.
The Sunrise and Sunset API is provided by Sunrise-Sunset.org (sunrise-sunset.org). API v2: sunrise, sunset, twilight, golden hour and solar position for any location, with automatic local timezone, ISO 8601 times and date ranges.
Yes. The Sunrise and Sunset API is listed in the Science & Math category of the public-apis directory, which only includes APIs that are free or have a free tier. Check its documentation for rate limits and paid plans.
No. The Sunrise and Sunset API requires no authentication, so you can start making requests without signing up.
Not directly. The Sunrise and Sunset API does not allow CORS, so call it from a server, serverless function or proxy instead of front-end JavaScript.
Yes. The Sunrise and Sunset API is served over HTTPS, so it's safe to use in production.