Free public API

Sunrise and sunset times API for any location and day

Golden sunset over layered clouds representing sunrise and sunset data

Retrieve sunrise, sunset, solar noon, and day length data using latitude and longitude. The API returns lightweight JSON, supports optional date lookups, and is simple to use from web, mobile, backend, and automation workflows.

Coordinate based Use latitude and longitude worldwide.
Date aware Query today or provide a specific date.
JSON output Built for direct app integration.

Why developers use this sunrise sunset API

This page is designed to answer the search intent behind queries like sunrise API, sunset API, solar noon API, and free API for sunrise and sunset times. It gives a direct endpoint, clear parameter rules, and a predictable response structure.

Use cases

  • Weather and astronomy applications
  • Smart home and lighting schedules
  • Photography, outdoor, and travel tools
  • Backend jobs and location-based automations

Returned values

  • Sunrise time
  • Sunset time
  • Solar noon
  • Day length

Implementation notes

  • CORS enabled for browser clients
  • No signup flow on the landing page
  • Simple query string parameters
  • Fast to test with cURL or fetch

API reference

Use the endpoint below to request sunrise and sunset data for any latitude and longitude pair.

Endpoint

GET /api?lat=55.8355&lng=13.3019

  • lat: latitude between -90 and 90
  • lng: longitude between -180 and 180
  • date: optional YYYY-MM-DD value

Example requests

/api?lat=40.7128&lng=-74.0060

/api?lat=40.7128&lng=-74.0060&date=2026-04-25

The second request fetches sunrise and sunset data for a specific date.

cURL examples

curl "https://your-domain.com/api?lat=40.7128&lng=-74.0060"
curl "https://your-domain.com/api?lat=40.7128&lng=-74.0060&date=2026-04-25"

Example response

{
	"results": {
		"sunrise": "2026-04-25T10:02:45+00:00",
		"sunset": "2026-04-25T23:48:10+00:00",
		"solar_noon": "2026-04-25T16:55:28+00:00",
		"day_length": "13:45:25"
	},
	"status": "OK",
	"tzid": "UTC"
}