Sunrise and Sunset
APIFree API for sunrise and sunset times by latitude and longitude
Overview
The Sunrise and Sunset API offers RESTful access to precise daylight-related times (sunrise, sunset, dawn, dusk, solar noon) for any geographic coordinate. Its primary GET endpoint accepts required latitude (lat) and longitude (lng) parameters, plus optional date (YYYY-MM-DD) and timezone offset. Responses are in JSON format, including both local and UTC times. Ideal use cases include weather apps, travel planners, photography scheduling tools (for golden hour), and outdoor event organizers aligning activities with daylight hours.
Example Integration (JavaScript)
fetch('https://sunrise-sunset.org/api')
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err)); Key Features
- RESTful API
- JSON response format
- No authentication required
- Supports custom date queries
- Returns dawn, dusk, and solar noon times
Frequently Asked Questions
? Is Sunrise and Sunset API free to use?
Yes, the API is completely free for public, non-commercial use. For commercial applications, refer to the website for any usage guidelines.
? Does it require an API Key?
No, the API does not require an authentication key—requests can be made directly with latitude and longitude parameters.
? What is the response format?
Responses are in JSON format, providing detailed time data such as sunrise, sunset, dawn (civil, nautical, astronomical), dusk (civil, nautical, astronomical), and solar noon in both local and UTC times.
Top Alternatives
People Also Ask about Sunrise and Sunset
Tool Info
Pros
- ⊕ Easy integration with minimal parameters
- ⊕ Completely free for public use
- ⊕ Comprehensive daylight time data
- ⊕ Supports UTC and local time outputs
Cons
- ⊖ Potential rate limits for high-volume usage
- ⊖ No official service level agreement (SLA)
- ⊖ Lacks bulk location query capabilities