Free forever
No signup, no API key, no credit card. Just include a link back to sunrisesunset.io.
JSON sunrise, sunset, twilight, golden hour, and moon data for any point on Earth. No signup, no key, no rate limit dance. Just call it.
api.sunrisesunset.io/json?lat=38.9&lng=-77fetch("https://api.sunrisesunset.io/json?lat=38.9&lng=-77")
.then(r => r.json())
.then(data => console.log(data.results.sunrise));curl "https://api.sunrisesunset.io/json?lat=38.9&lng=-77"{
"results": {
"date": "2026-06-21",
"sunrise": "5:43:05 AM",
"sunset": "8:36:50 PM",
"first_light": "3:42:17 AM",
"last_light": "10:37:38 PM",
"dawn": "5:10:24 AM",
"dusk": "9:09:31 PM",
"solar_noon": "1:09:58 PM",
"golden_hour": "7:58:12 PM",
"day_length": "14:53:45",
"nautical_twilight_begin": "4:28:40 AM",
"nautical_twilight_end": "9:51:15 PM",
"timezone": "America/New_York",
"utc_offset": -240,
"sun_altitude": 72.58,
"sun_azimuth": 180.27,
"sunrise_azimuth": 58.14,
"sunset_azimuth": 301.86,
"moonrise": "1:16:23 PM",
"moonset": "1:42:05 AM",
"moon_illumination": 24.7,
"moon_phase": "Waxing Crescent",
"moon_phase_value": 0.22,
"moon_always_up": false,
"moon_always_down": false,
"elevation": 26
},
"status": "OK",
"tzid": "America/New_York"
}No signup, no API key, no credit card. Just include a link back to sunrisesunset.io.
Hosted on Cloudflare Workers in 300+ cities. P99 response times under 50 ms.
One request returns a full year of daily data via date_start + date_end.
Rise, set, azimuth, altitude, and moon phase. All in one endpoint.
All sent as query-string values on a single GET request.
latRequirednumber38.907192lngRequirednumber-77.036873dateOptionalstring2026-06-21date_startOptionalstringdate_endOptionalstringtimezoneOptionalIANA tzautoAmerica/New_Yorktime_formatOptionalenum12formattedOptional0 | 11elevationOptionalnumber | falseautocallbackOptionalstringWrapped in { results, status, tzid }. results is a single object, or an array when a date range is used.
datesunrisesunsetdawnduskfirst_lightlast_lightnautical_twilight_beginnautical_twilight_endsolar_noongolden_hourday_lengthtimezoneutc_offsetsun_altitudesun_azimuthsunrise_azimuthsunset_azimuthmoonrisemoonsetmoon_illuminationmoon_phasemoon_phase_valuemoon_always_upmoon_always_downelevationReturned in the status field. HTTP status follows logically — 200 for OK and INVALID_TZID (which still returns data), 400 for bad input, 500 for unexpected.
OKRequest succeeded.INVALID_TZIDTimezone parameter couldn't be validated; we fell back to the location's timezone and still returned data.INVALID_REQUESTMissing or malformed lat/lng.INVALID_DATEUnparseable date, or a range longer than one year.UNKNOWN_ERRORSomething went wrong on our end. Retry.The API is free for personal and commercial use. All we ask is a visible backlink. Paste this anywhere on your site:
Powered by <a href="https://sunrisesunset.io">SunriseSunset.io</a>Authorization: Bearer sss_.... Never put it in the URL query string — query strings get logged by every proxy and CDN on the wire.moon_always_up or moon_always_down flip to true at polar latitudes.date_start and date_end (up to 365 days apart). You get an array of daily objects in one request.timezone parameter.Moon data (rise/set, phase, illumination), sun altitude/azimuth at solar noon + rise + set, automatic elevation from terrain.
JSONP callback, formatted=0 for ISO 8601 output, nautical twilight fields, granular status codes.
Fixed a DST edge-case that could return the wrong day at the boundary.
time_format option (12, 24, military, unix).
date_start + date_end range queries, up to 365 days.
Lower response times; migrated onto Cloudflare Workers.
utc_offset added to responses.
first_light + last_light fields (astronomical twilight).
API released.
Watching the API? Status page