Sunrise and Sunset API
Overview
The Sunrise and Sunset API returns accurate sunrise, sunset, solar noon, and day length data for any latitude/longitude coordinate on Earth. It is completely free and requires no API key, making it one of the easiest APIs to start with. Use it to build apps that adapt content or UI based on daylight, from smart home automation to photography planning tools.
Beginner Tip
Pass any latitude and longitude plus a date to get precise solar times — for example, use your city coordinates to see today sunrise and sunset. All times are returned in UTC by default; add tzid=YOUR_TIMEZONE to get local times.
Available Data
Example Response
{
"status": "success",
"data": {
"result": "Data from Sunrise and Sunset",
"description": "Sunset and sunrise times for a given latitude and longitude",
"timestamp": "2025-01-15T10:00:00Z"
}
} Field Reference
results.sunrise ISO 8601 timestamp of sunrise for the requested location and date. results.sunset ISO 8601 timestamp of sunset for the requested location and date. results.solar_noon The time when the sun reaches its highest point in the sky. results.day_length Total length of the day in seconds between sunrise and sunset. results.civil_twilight_begin Start of civil twilight when the sky first begins to lighten before sunrise. status Request status — OK on success or INVALID_REQUEST when parameters are wrong. Implementation Example
// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://sunrise-sunset.org/api";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data); What Can You Build?
Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.
Common Errors & Troubleshooting
Matrix Score Breakdown
Fully tested on Apr 5, 2026
Technical Specifications
Related Tags
Similar APIs
View All →arcsecond.io
⭐ Beginner's Pickarcsecond.io is a free astronomy API that aggregates data from multiple space databases, including stars, planets, exoplanets, and observing sites.
arXiv
arXiv provides programmatic access to curated research-sharing platform: physics, mathematics, quantitative finance, and economics via REST API.
GBIF
⭐ Beginner's PickGBIF (Global Biodiversity Information Facility) is a free, open API providing access to hundreds of millions of species occurrence records from around the world.
iDigBio
iDigBio is a free API that gives you access to millions of digitized natural history museum specimens from institutions across the United States and beyond.
inspirehep.net
INSPIRE-HEP is a free REST API for the High Energy Physics literature database, covering papers, authors, institutions, conferences, and experiments in particle physics.