Sunrise, Sunset & Moon Phase API

Sunrise, sunset, solar noon, civil twilight, moonrise, moonset, Moon phase and illumination for any place and day, computed by the U.S. Naval Observatory. Date ranges and many places in one run: one record per place and day.

$2 per 1,000 records

You pay only for the records you get. Zero records cost zero. 2,500 free records of this API to start (5,000 at the base price of $1 per 1,000), no card.

Try it
Ready-made, maintained by usRecords, 23 fieldsv1.0

Data from aa.usno.navy.mil/data/api

Get this data

Try it here with a few records, download the sample, fill a Google Sheet, or call it from your own code.

Try it

Dateoptional
The day, as YYYY-MM-DD. Leave it empty for today at the place.
Example: 2026-12-05
End dateoptional
Last day of a range, as YYYY-MM-DD: every day from date to end_date is one record (at most 400 days).
Example: 2026-12-11
Latitudeoptional
Latitude in decimal degrees, north positive, such as 43.65 for Toronto.
Example: 43.65
Longitudeoptional
Longitude in decimal degrees, east positive and west negative, such as -79.38 for Toronto.
Example: -79.38
Tz offsetoptional
Hours from UTC for the times, such as -5 for Toronto in winter or 5.5 for India. Empty means 0 (UTC).
Example: -5
Dstoptional
Add an hour during U.S. daylight saving time (the dates the U.S. and most of Canada use). Elsewhere leave it off and give the offset in force.
Placesoptional
Several places in one run instead of latitude and longitude, each as "latitude,longitude" or "name: latitude,longitude,hours from UTC", such as "London: 51.51,-0.13,0". One per line.
Example: Toronto: 43.65,-79.38,-5 · London: 51.51,-0.13,0

Run it on this page, or call it from your code with the endpoint in the developer section. A free key covers 2,500 records of this API, no card. Create a free key

For developers: the API and MCPThe endpoint, code in curl, JavaScript and Python, every input, and files for your tools
Endpoint
POSThttps://pullrow.dev/v1/apis/usno-sun-moon/run
  • Small runs answer in the same request; longer ones answer 202 with a run to poll.
  • fields returns only the fields you name. The examples send the ones picked on this page.
  • Idempotency-Key is optional. A retry with it is never charged twice.
  • You pay for records returned. Zero records cost zero.

Every run option, explained

Calling it needs a key
2,500 free records of this API to start. No card.
curl
curl -X POST "https://pullrow.dev/v1/apis/usno-sun-moon/run" \
  -H "Authorization: Bearer $PULLROW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"date":"2026-12-05"},"max_items":50}'

Inputs

Send them as input in the request body. Leave one out to use its default.

datetext
The day, as YYYY-MM-DD. Leave it empty for today at the place.
example: 2026-12-05
end_datetext
Last day of a range, as YYYY-MM-DD: every day from date to end_date is one record (at most 400 days).
example: 2026-12-11
latitudenumber
Latitude in decimal degrees, north positive, such as 43.65 for Toronto.
example: 43.65
longitudenumber
Longitude in decimal degrees, east positive and west negative, such as -79.38 for Toronto.
example: -79.38
tz_offsetnumber
Hours from UTC for the times, such as -5 for Toronto in winter or 5.5 for India. Empty means 0 (UTC).
example: -5
dstyes/no
Add an hour during U.S. daylight saving time (the dates the U.S. and most of Canada use). Elsewhere leave it off and give the offset in force.
default: false
placeslist
Several places in one run instead of latitude and longitude, each as "latitude,longitude" or "name: latitude,longitude,hours from UTC", such as "London: 51.51,-0.13,0".
example: Toronto: 43.65,-79.38,-5, London: 51.51,-0.13,0

What's in each record

23 fields.

Basics

  • Place

    The place's name as you gave it, or its latitude and longitude.

    Example Toronto

  • Day of week

    Day of the week, such as Saturday.

    Example Saturday

  • Tz offset

    Hours from UTC of the times in this record, before any daylight saving hour.

    Example -5

  • Dst

    Yes when U.S. daylight saving time was added to the times of this day.

    Example No

  • Sunrise

    Local time the Sun rises, as HH:MM.

    Example 07:35

  • Sunset

    Local time the Sun sets, as HH:MM.

    Example 16:41

  • Solar noon

    Local time the Sun is highest in the sky (upper transit), as HH:MM.

    Example 12:08

  • Civil twilight begin

    Local time morning civil twilight begins (first light, Sun 6 degrees below the horizon), as HH:MM.

    Example 07:03

  • Civil twilight end

    Local time evening civil twilight ends (last light), as HH:MM.

    Example 17:13

  • Day length (minutes)

    Minutes from sunrise to sunset; 1440 in polar day and 0 in polar night.

    Example 546

  • Sun note

    Set when the Sun stays above or below the horizon or the twilight limit all day.

    Example The Sun stays below the horizon all day.

  • Moonrise

    Local time the Moon rises, as HH:MM; empty on a day it does not rise.

    Example 04:23

  • Moonset

    Local time the Moon sets, as HH:MM; empty on a day it does not set.

    Example 14:18

  • Moon transit

    Local time the Moon is highest in the sky, as HH:MM.

    Example 09:24

  • Moon note

    Set when the Moon stays above or below the horizon all day.

    Example The Moon stays below the horizon all day.

  • Moon phase

    Phase of the Moon on that day, such as Waning Crescent or Full Moon.

    Example Waning Crescent

  • Moon illumination

    Share of the Moon's disc that is lit at local noon, in percent (0 to 100).

    Example 10%

  • Closest phase

    The nearest primary phase: New Moon, First Quarter, Full Moon or Last Quarter.

    Example New Moon

Location

  • Latitude

    Latitude of the place in decimal degrees (north positive).

    Example 43.65

  • Longitude

    Longitude of the place in decimal degrees (east positive).

    Example -79.38

Dates

  • Date

    The local day these times are for.

    Example Dec 5, 2026

  • Closest phase date

    The local day of that nearest primary phase.

    Example Dec 8, 2026

  • Closest phase time

    Local time of that nearest primary phase, as HH:MM.

    Example 19:52

Technical detailsField names and types for developers

Field names and types

The names your code reads in each record. "Filled" counts how many of the 3 sample records carry the field.

Field nameTypeShown on this page asFilled
placetextPlace3 of 3
latitudenumberLatitude3 of 3
longitudenumberLongitude3 of 3
datedateDate3 of 3
day_of_weektextDay of week3 of 3
tz_offsetnumberTz offset3 of 3
is_dstyes or noDst3 of 3
sunrisetextSunrise3 of 3
sunsettextSunset3 of 3
solar_noontextSolar noon3 of 3
civil_twilight_begintextCivil twilight begin3 of 3
civil_twilight_endtextCivil twilight end3 of 3
day_length_minutesnumberDay length (minutes)3 of 3
sun_notetextSun note0 of 3
moonrisetextMoonrise3 of 3
moonsettextMoonset3 of 3
moon_transittextMoon transit3 of 3
moon_notetextMoon note0 of 3
moon_phasetextMoon phase3 of 3
moon_illuminationnumberMoon illumination3 of 3
closest_phasetextClosest phase3 of 3
closest_phase_datedateClosest phase date3 of 3
closest_phase_timetextClosest phase time3 of 3

How it reads the site

Runs on a reader we built and maintain by hand for this site.

Sample records

Sample records
RecordPlaceDay of weekTz offsetDstSunriseSunsetSolar noonCivil twilight beginCivil twilight endDay length (minutes)Sun noteMoonriseMoonsetMoon transitMoon noteMoon phaseMoon illuminationClosest phaseLatitudeLongitudeDateClosest phase dateClosest phase time
1TorontoSaturday-5No07:3516:4112:0807:0317:13546—04:2314:1809:24—Waning Crescent10%New Moon43.65-79.38Dec 5, 2026Dec 8, 202619:52
2TorontoSunday-5No07:3616:4112:0907:0417:13545—05:3014:4610:11—Waning Crescent5%New Moon43.65-79.38Dec 6, 2026Dec 8, 202619:52
3TorontoMonday-5No07:3716:4112:0907:0517:13544—06:3615:2011:00—Waning Crescent2%New Moon43.65-79.38Dec 7, 2026Dec 8, 202619:52

Sample records from the example output this API publishes. Email addresses and phone numbers in them are masked. Hover over a column name to see the field name your code reads.

Reliability

Counted from real runs. Our own health checks are left out. A run succeeded when it finished and the site neither blocked it nor broke it.

Incidents and repairs

How it is kept working What a repair can't do

A ready-made API, maintained by us. It is not part of the daily check or the automatic rebuild yet.

  • You pay only for records returned. A run that returns none costs nothing.
Known limits
  • Times come from the U.S. Naval Observatory, public data of the U.S. Navy. They use the offset you give, not a time-zone database: give the offset in force on those days (-4 for Toronto in summer) or set dst for U.S. daylight saving time.
  • The source answers one place and one day per request, about two requests a second: a full year for one place takes about three minutes. At most 400 records (places times days) per run.
  • Days from 1700 to 2100 only. Times are to the minute for a level horizon at sea level; hills, buildings and weather can shift what you see by a few minutes.
  • On about one day a month the Moon does not rise, or does not set, within the local day: that time is then empty. In polar day or night the Sun's times are empty and sun_note says why.
  • moon_illumination is the share of the Moon's disc that is lit at local noon, in whole percent; moon_phase names the phase on that day.
  • The Naval Observatory's server sometimes does not answer at once. Each request is tried three times; a run that still gets no answer stops early with the records read so far, and can simply be run again.

Version history

A run uses the live version unless the request names another one with version.