Sun & Moon API

Sunrise, sunset, civil dawn and dusk, day length, moon phase, illumination, moonrise and moonset for any place and date, up to 7 days per call.

50 free requests, no credit card.
GET/api/v1/astronomyMonterey, California (local time)
{
    "lat": 36.605,
    "lon": -121.888,
    "timezone": "America/Los_Angeles",
    "date": "2026-10-18",
    "days": 2,
    "data": [
        {
            "date": "2026-10-18",
            "sun": {
                "sunrise": "07:18",
                "sunset": "18:28",
                "dawn": "06:52",
                "dusk": "18:54",
                "day_length": "11:10"
            },
            "moon": {
                "phase": "waxing_crescent",
                "illumination_pct": 48.9,
                "age_days": 7.3,
                "moonrise": "16:29",
                "moonset": "01:36"
            }
        }
    ],
    "port": {
        "name": "Monterey Ca",
        "slug": "monterey-ca",
        "country": "United States"
    }
}
Days per call1 to 7
Any datepast or future
Time zonelocal with port, UTC with lat/lon
Computationastronomical, no model

Request

GEThttps://tidesatlas.com/api/v1/astronomy
ParameterTypeDescription
lat, lonfloatCoordinates (decimal degrees). Times are returned in UTC.
portstringInstead of lat/lon: a station slug. Times are returned in the station's local time zone.
dateYYYY-MM-DDFirst day. Default: today.
daysint1 to 7. Default 1.
X-API-KeyheaderYour API key (or ?api_key= in the query string).

Code examples

curl "https://tidesatlas.com/api/v1/astronomy?port=monterey-ca&days=1" \
  -H "X-API-Key: YOUR_KEY"

Response

Real response for Monterey, California (local time), 18 October 2026 (arrays shortened).

{
    "lat": 36.605,
    "lon": -121.888,
    "timezone": "America/Los_Angeles",
    "date": "2026-10-18",
    "days": 2,
    "data": [
        {
            "date": "2026-10-18",
            "sun": {
                "sunrise": "07:18",
                "sunset": "18:28",
                "dawn": "06:52",
                "dusk": "18:54",
                "day_length": "11:10"
            },
            "moon": {
                "phase": "waxing_crescent",
                "illumination_pct": 48.9,
                "age_days": 7.3,
                "moonrise": "16:29",
                "moonset": "01:36"
            }
        }
    ],
    "port": {
        "name": "Monterey Ca",
        "slug": "monterey-ca",
        "country": "United States"
    }
}
FieldMeaning
data[].sun.sunrise / sunsetSunrise and sunset, HH:MM
data[].sun.dawn / duskCivil twilight start and end
data[].sun.day_lengthDay length, HH:MM
data[].moon.phasenew_moon, waxing_crescent, first_quarter, waxing_gibbous, full_moon, …
data[].moon.illumination_pct / age_daysIlluminated fraction (%) and days since new moon
data[].moon.moonrise / moonsetMoonrise and moonset, HH:MM

Data sources

Computed on our servers with standard astronomical algorithms (solar position and lunar ephemeris). No external service, so responses are fast and available for any date.

Good to know

  • With lat/lon the times are UTC: for places far from Greenwich, sunset can fall on the next UTC day. Use port to get local times.
  • Twilight is civil twilight (sun 6° below the horizon).

FAQ

Can I query a date in the past?

Yes, any date: pass date=YYYY-MM-DD.

Why do fishermen and photographers use it?

Moon phase drives tidal range (spring tides near new and full moon); dawn, dusk and moonrise plan the light.

Which plans include it?

The Complete pack, which also includes tides, and the weather-only pack. New accounts get 50 free requests; see the docs for current prices.