Download OpenAPI specification:
Our free API tells you when the sun rises and sets anywhere on Earth, plus twilight, golden hour, solar position and moon data. All you need is a latitude and longitude; you make a simple GET request and get the answer as JSON.
Time come in the local timezone of the place, and you can ask for a single day or up to a whole year in one request.
The API is free to use; no sign up or API key required.
Returns when the sun rises and sets anywhere on Earth, plus twilight, golden hour, solar position and moon data.
| lat required | number <float> [ -90 .. 90 ] Example: lat=36.72016 Latitude in decimal degrees, -90 to 90. |
| lng required | number <float> [ -180 .. 180 ] Example: lng=4.42034 Longitude in decimal degrees, -180 to 180. |
| date | string Example: date=tomorrow Date in |
| date_start | string <date> Example: date_start=2026-01-01 Start date in |
| date_end | string <date> Example: date_end=2026-12-31 End date in |
| tz | string Example: tz=Europe/Madrid Timezone of the location. You usually don't need this as the default time comes in the location's time zone. Set it if only you want the times expressed in a different time zone, using a standard time zone name, such as |
| time_format | string Default: "iso8601" Enum: "iso8601" "unix" Example: time_format=iso8601 The time format of events. By default, the response would be in |
{- "sunrise": "2026-08-07T07:27:08+02:00",
- "sunset": "2026-08-07T21:19:49+02:00",
- "solar_noon": "2026-08-07T14:23:28+02:00",
- "day_length": 49961,
- "sun_status": "normal",
- "civil_twilight_begin": "2026-08-09T07:02:15+02:00",
- "civil_twilight_end": "2026-08-09T21:44:10+02:00",
- "nautical_twilight_begin": "2026-08-07T06:26:26+02:00",
- "nautical_twilight_end": "2026-08-07T22:20:30+02:00",
- "astronomical_twilight_begin": "2026-08-09T05:52:33+02:00",
- "astronomical_twilight_end": "2026-08-09T22:53:51+02:00",
- "dawn": "2026-08-07T07:00:27+02:00",
- "dusk": "2026-08-07T21:46:29+02:00",
- "first_light": "2026-08-07T05:50:09+02:00",
- "last_light": "2026-08-07T22:56:48+02:00",
- "golden_hour": {
- "morning": {
- "begin": "2026-08-07T07:11:11+02:00",
- "end": "2026-08-07T08:04:20+02:00"
}, - "evening": {
- "begin": "2026-08-07T20:42:10+02:00",
- "end": "2026-08-07T21:35:11+02:00"
}
}, - "blue_hour": {
- "morning": {
- "begin": "2026-08-07T07:00:27+02:00",
- "end": "2026-08-07T07:11:11+02:00"
}, - "evening": {
- "begin": "2026-08-07T21:35:11+02:00",
- "end": "2026-08-07T21:46:29+02:00"
}
}, - "solar_position": {
- "sunrise_azimuth": 68.52,
- "sunset_azimuth": 291.35,
- "solar_noon_azimuth": 179.99,
- "solar_noon_altitude": 69.61
}, - "moonrise": "2026-08-07T01:27:00+02:00",
- "moonset": "2026-08-07T16:47:30+02:00",
- "moon_phase": "Last Quarter",
- "moon_illumination": 100
}