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.
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
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
- Small runs answer in the same request; longer ones answer
202with a run to poll. fieldsreturns only the fields you name. The examples send the ones picked on this page.Idempotency-Keyis optional. A retry with it is never charged twice.- You pay for records returned. Zero records cost zero.
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.
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 name | Type | Shown on this page as | Filled |
|---|---|---|---|
place | text | Place | 3 of 3 |
latitude | number | Latitude | 3 of 3 |
longitude | number | Longitude | 3 of 3 |
date | date | Date | 3 of 3 |
day_of_week | text | Day of week | 3 of 3 |
tz_offset | number | Tz offset | 3 of 3 |
is_dst | yes or no | Dst | 3 of 3 |
sunrise | text | Sunrise | 3 of 3 |
sunset | text | Sunset | 3 of 3 |
solar_noon | text | Solar noon | 3 of 3 |
civil_twilight_begin | text | Civil twilight begin | 3 of 3 |
civil_twilight_end | text | Civil twilight end | 3 of 3 |
day_length_minutes | number | Day length (minutes) | 3 of 3 |
sun_note | text | Sun note | 0 of 3 |
moonrise | text | Moonrise | 3 of 3 |
moonset | text | Moonset | 3 of 3 |
moon_transit | text | Moon transit | 3 of 3 |
moon_note | text | Moon note | 0 of 3 |
moon_phase | text | Moon phase | 3 of 3 |
moon_illumination | number | Moon illumination | 3 of 3 |
closest_phase | text | Closest phase | 3 of 3 |
closest_phase_date | date | Closest phase date | 3 of 3 |
closest_phase_time | text | Closest phase time | 3 of 3 |
How it reads the site
Runs on a reader we built and maintain by hand for this site.
Save as pipeline
A pipeline remembers this API, your inputs and the fields you picked. It can run on a schedule and email you the results.
Sample records
| Record | Place | Day of week | Tz offset | Dst | Sunrise | Sunset | Solar noon | Civil twilight begin | Civil twilight end | Day length (minutes) | Sun note | Moonrise | Moonset | Moon transit | Moon note | Moon phase | Moon illumination | Closest phase | Latitude | Longitude | Date | Closest phase date | Closest phase time |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Toronto | Saturday | -5 | No | 07:35 | 16:41 | 12:08 | 07:03 | 17:13 | 546 | — | 04:23 | 14:18 | 09:24 | — | Waning Crescent | 10% | New Moon | 43.65 | -79.38 | Dec 5, 2026 | Dec 8, 2026 | 19:52 |
| 2 | Toronto | Sunday | -5 | No | 07:36 | 16:41 | 12:09 | 07:04 | 17:13 | 545 | — | 05:30 | 14:46 | 10:11 | — | Waning Crescent | 5% | New Moon | 43.65 | -79.38 | Dec 6, 2026 | Dec 8, 2026 | 19:52 |
| 3 | Toronto | Monday | -5 | No | 07:37 | 16:41 | 12:09 | 07:05 | 17:13 | 544 | — | 06:36 | 15:20 | 11:00 | — | Waning Crescent | 2% | New Moon | 43.65 | -79.38 | Dec 7, 2026 | Dec 8, 2026 | 19: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.
- 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.
Manage this API
Only your workspace sees this part.
Automatic repair
Off: a rebuilt version is stored and waits for you in the version history.
Delete this API
Removes the API, its versions and the saved records of its runs. Calls to its address then answer 404. Records already charged stay charged. This cannot be undone.