Free Sunrise, Sunset & Moon API
发布时间:2026-09-14 | 浏览:1
Sunrise, sunset, twilight, golden hour and moon data for any point on Earth. One GET request, no key, no signup.
Runs against the live API from your browser.
Today https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873 Copy
Specific date https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873&date=2026-06-21&timezone=UTC Copy
One-year range https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873&date_start=2026-01-01&date_end=2026-12-31 Copy
24-hour times https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873&time_format=24 Copy
Unix timestamps https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873&time_format=unix Copy
ISO 8601 https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873&formatted=0 Copy
Query-string values on a single GET request.
Latitude in decimal degrees.
Example 38.907192
Longitude in decimal degrees.
Example -77.036873
Date to query. ISO YYYY-MM-DD, or a relative word like "today" or "tomorrow". Defaults to today in the location's timezone.
Example 2026-06-21
Start of a date range (inclusive). Must be paired with date_end. Up to 365 days.
End of a date range (inclusive). Returns an array of daily results instead of a single object.
Return times in this timezone. Defaults to the location's IANA timezone resolved from lat/lng. An invalid value still returns data, with status INVALID_TZID and the detected zone.
Default auto Example America/New_York
Format of all time fields. One of 12, 24, military, unix. Unix timestamps are always UTC.
Set to 0 to receive times in ISO 8601 format and day_length in seconds.
Elevation override in meters. By default, auto-detected from terrain via ETOPO1. Pass false to compute at sea level. Higher elevation pushes sunrise earlier and sunset later.
JSONP callback function name. Returns application/javascript wrapped in your callback when present.
Response fields
Wrapped in { results, status, tzid } . results is one object, or an array when you pass a date range.
Returned in status . The HTTP status matches: 200 for OK and INVALID_TZID, 400 for bad input, 500 for server errors.
Free for personal and commercial use. In return, put a visible link back to sunrisesunset.io on your site.
For AI assistants
A plain-text reference to paste into ChatGPT, Claude or Cursor before asking for code. It lists every parameter and field, plus the edge cases that trip up first drafts: nulls at the poles, utc_offset in minutes, times as strings rather than dates.
There is also an OpenAPI 3.0 spec, as JSON or YAML , for Postman, Insomnia, or generating a typed client.