TidyData APIsAll APIsPricing

Sunrise Sunset & Moon Phase API

Sunrise, sunset, solar noon, day length, civil/nautical/astronomical twilight and golden hour for any coordinates and date, plus moon phase, illumination, moonrise/moonset and next full and new moon. Times are returned in the local time zone, detected automatically from the coordinates.

Authentication & base URL

Subscribe through one of our marketplace listings; your marketplace API key and base URL are shown there. All endpoints return JSON over HTTPS, served from a global edge network (typically 20–150 ms).

Subscribe on RapidAPI

Endpoints

GET /v1/sun

Sun times

ParameterInDescriptionExample
lat *queryLatitude40.4168
lon *queryLongitude-3.7038
datequeryDate YYYY-MM-DD (default: today)2026-06-21
tzqueryIANA time zone for the returned times, or 'auto' (detected from coordinates)auto

GET /v1/moon

Moon phase and times

ParameterInDescriptionExample
lat *queryLatitude40.4168
lon *queryLongitude-3.7038
datequeryDate YYYY-MM-DD (default: today)2026-06-21
tzqueryIANA time zone for the returned times, or 'auto' (detected from coordinates)auto

Example

GET /v1/sun?lat=40.4168&lon=-3.7038&date=2026-06-21&tz=auto

{
  "lat": 40.4168,
  "lon": -3.7038,
  "timezone": "Europe/Madrid",
  "date": "2026-06-21",
  "sunrise": "2026-06-21T06:45:59+02:00",
  "sunset": "2026-06-21T21:49:38+02:00",
  "solarNoon": "2026-06-21T14:17:48+02:00",
  "nadir": "2026-06-21T02:17:48+02:00",
  "dayLength": "15h 3m 39s",
  "dayLengthSeconds": 54219,
  "civilTwilight": {
    "dawn": "2026-06-21T06:12:47+02:00",
    "dusk": "2026-06-21T22:22:49+02:00"
  },
  "nauticalTwilight": {
    "dawn": "2026-06-21T05:30:30+02:00",
    "dusk": "2026-06-21T23:05:06+02:00"
  },
  "astronomicalTwilight": {
    "dawn": "2026-06-21T04:40:48+02:00",
    "dusk": "2026-06-21T23:54:49+02:00"
  },
  "goldenHour": {
    "morningEnds": "2026-06-21T07:27:04+02:00",
    "eveningStarts": "2026-06-21T21:08:32+02:00"
  },
  "sunAltitudeAtNoonDeg": 73.02
}

Sunrise, sunset, solar noon, day length, civil/nautical/astronomical twilight and golden hour for any coordinates and date, plus moon phase, illumination, moonrise/moonset and next full and new moon. Times are returned in the local time zone, detected automatically from the coordinates.

Use cases

Weather and outdoor apps, photography (golden hour planning), smart-home lighting automations, prayer and calendar apps, fishing and hunting apps, astronomy dashboards, solar energy estimates.

Why this API

Pricing

Free plan with 500 calls per month, then Pro (25,000 calls for $4.99/month) and Ultra (150,000 calls for $14.99/month). See all plans.