How to hit the Sunrise Sunset API

Sunrise Sunset at https://api.sunrise-sunset.org/json returns sunrise, sunset, solar noon, and twilight times for a latitude and longitude.

Authentication

None — no key, no signup. Every example runs as-is.

Full reference: https://sunrise-sunset.org/api

Times for a date

formatted=0 returns ISO 8601 timestamps in UTC instead of 12-hour strings.

curl "https://api.sunrise-sunset.org/json?lat=40.71&lng=-74.01&date=2026-06-21&formatted=0"
Run in PostTaco
Example response (trimmed)
{
  "results": {
    "sunrise": "2026-06-21T09:23:28+00:00",
    "sunset": "2026-06-22T00:32:20+00:00",
    "solar_noon": "2026-06-21T16:57:54+00:00",
    "day_length": 54532,
    "civil_twilight_begin": "2026-06-21T08:51:42+00:00",
    "civil_twilight_end": "2026-06-22T01:04:07+00:00",
    "nautical_twilight_begin": "2026-06-21T08:09:03+00:00",
    "nautical_twilight_end": "2026-06-22T01:46:46+00:00",
    "astronomical_twilight_begin": "2026-06-21T07:18:39+00:00",
    "astronomical_twilight_end": "2026-06-22T02:37:10+00:00"
  },
  "status": "OK",
  "tzid": "UTC"
}

Times in a local time zone

tzid converts the times to that zone.

curl "https://api.sunrise-sunset.org/json?lat=51.51&lng=-0.13&date=2026-12-21&tzid=Europe/London"
Run in PostTaco
Example response (trimmed)
{
  "results": {
    "sunrise": "8:01:36 AM",
    "sunset": "3:55:33 PM",
    "solar_noon": "11:58:35 AM",
    "day_length": "07:53:57",
    "civil_twilight_begin": "7:23:30 AM",
    "civil_twilight_end": "4:33:40 PM",
    "nautical_twilight_begin": "6:40:18 AM",
    "nautical_twilight_end": "5:16:51 PM",
    "astronomical_twilight_begin": "5:59:30 AM",
    "astronomical_twilight_end": "5:57:40 PM"
  },
  "status": "OK",
  "tzid": "Europe/London"
}