Sunset and Sunrise Times API

SunriseSunset.io offers a free API for retrieving sunrise and sunset times for a specific longitude and latitude. This is perfect for displaying sunset and sunrise times in your applications. Requests are sent using GET parameters and returned data is in JSON format.

SunriseSunset.io API Status Page

Parameters:

lat (Required): Latitude of the location in decimal degrees. Example: 38.907192
lng (Required): Longitude of the location in decimal degrees. Example: -77.036873
date (Optional): Date in YYYY-MM-DD format, you can also specify relative formats such as “today” and “tomorrow”. If not set it’ll default to today.
timezone (Optional): Set a timezone of the returned times. By default the API will return the times in the location’s timezone. Example: UTC

Example Request:

https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873&timezone=UTC&date=today
https://api.sunrisesunset.io/json?lat=38.907192&lng=-77.036873&timezone=UTC&date=1990-05-22

Example returned data

{
	"results": {
		"sunrise": "9:44:04 AM",
		"sunset": "12:37:55 AM",
		"first_light": "7:44:58 AM",
		"last_light": "2:37:01 AM",
		"dawn": "9:11:59 AM",
		"dusk": "1:10:00 AM",
		"solar_noon": "5:10:59 PM",
		"golden_hour": "11:57:57 PM",
		"day_length": "14:53:51",
		"timezone": "UTC"
	},
	"status": "OK"
}

If you plan on using our free API you must include a link to our site. For example “Powered by SunriseSunset.io“.

Changelog

  • June 21, 2022: Added first light and last light to returned information.
  • June 17 2022: Added link to API status page.
  • June 9, 2022: API Released.