One Astronomy API call returns sun, moon, twilight, and golden hour data for any date, past or future, by coordinates, city, address, or IP. Free for 1,000 requests a day.
Trusted by teams at
The Astronomy API returns sunrise, sunset, moonrise, moonset, moon phase, twilight, golden hour, and blue hour times for any location and any date. Query it with coordinates, an IPv4 or IPv6 address, a city name, or a street address, and every time in the response is local to that place.
curl 'https://api.ipgeolocation.io/v3/astronomy?apiKey=API_KEY&lat=40.76473&long=-74.00084'1{
2 "location": {
3 "latitude": "40.76473",
4 "longitude": "-74.00084",
5 "country_name": "United States",
6 "state_prov": "New York",
7 "city": "New York",
8 "locality": "Midtown West",
9 "elevation": "9"
10 },
11 "astronomy": {
12 "date": "2026-08-19",
13 "current_time": "02:25:42.544",
14 "mid_night": "00:59",
15 "night_end": "04:28",
16 "morning": {
17 "astronomical_twilight_begin": "04:28",
18 "astronomical_twilight_end": "05:06",
19 "nautical_twilight_begin": "05:06",
20 "nautical_twilight_end": "05:41",
21 "civil_twilight_begin": "05:41",
22 "civil_twilight_end": "06:09",
23 "blue_hour_begin": "05:29",
24 "blue_hour_end": "05:52",
25 "golden_hour_begin": "05:52",
26 "golden_hour_end": "06:47"
27 },
28 "sunrise": "06:09",
29 "sunset": "19:48",
30 "evening": {
31 "golden_hour_begin": "19:11",
32 "golden_hour_end": "20:05",
33 "blue_hour_begin": "20:05",
34 "blue_hour_end": "20:28",
35 "civil_twilight_begin": "19:48",
36 "civil_twilight_end": "20:17",
37 "nautical_twilight_begin": "20:17",
38 "nautical_twilight_end": "20:52",
39 "astronomical_twilight_begin": "20:52",
40 "astronomical_twilight_end": "21:29"
41 },
42 "night_begin": "21:29",
43 "sun_status": "-",
44 "solar_noon": "12:59",
45 "day_length": "13:39",
46 "sun_altitude": -32.909747839506174,
47 "sun_distance": 151434594.7878357,
48 "sun_azimuth": 25.198749383374206,
49 "moon_phase": "FIRST_QUARTER",
50 "moonrise": "13:46",
51 "moonset": "23:03",
52 "moon_status": "-",
53 "moon_altitude": -41.94173517451815,
54 "moon_distance": 398747.92917074164,
55 "moon_azimuth": 276.65671450158897,
56 "moon_parallactic_angle": 54.11011524338014,
57 "moon_illumination_percentage": "41.74",
58 "moon_angle": 80.48957371739807
59 }
60}The Astronomy API provides a detailed dataset about twilight times, different sun and moon parameters for a given date and location.
Full API Docscurl 'https://api.ipgeolocation.io/v3/astronomy?apiKey=API_KEY&location=New York'1{
2 "location": {
3 "location_string": "New York",
4 "country_name": "United States",
5 "state_prov": "New York",
6 "city": "New York",
7 "locality": "",
8 "latitude": "40.71273",
9 "longitude": "-74.00602",
10 "elevation": "6"
11 },
12 "astronomy": {
13 "date": "2026-08-19",
14 "current_time": "02:28:41.898",
15 "mid_night": "00:59",
16 "night_end": "04:29",
17 "morning": {
18 "astronomical_twilight_begin": "04:29",
19 "astronomical_twilight_end": "05:06",
20 "nautical_twilight_begin": "05:06",
21 "nautical_twilight_end": "05:41",
22 "civil_twilight_begin": "05:41",
23 "civil_twilight_end": "06:10",
24 "blue_hour_begin": "05:30",
25 "blue_hour_end": "05:52",
26 "golden_hour_begin": "05:52",
27 "golden_hour_end": "06:47"
28 },
29 "sunrise": "06:10",
30 "sunset": "19:48",
31 "evening": {
32 "golden_hour_begin": "19:11",
33 "golden_hour_end": "20:05",
34 "blue_hour_begin": "20:05",
35 "blue_hour_end": "20:28",
36 "civil_twilight_begin": "19:48",
37 "civil_twilight_end": "20:17",
38 "nautical_twilight_begin": "20:17",
39 "nautical_twilight_end": "20:52",
40 "astronomical_twilight_begin": "20:52",
41 "astronomical_twilight_end": "21:29"
42 },
43 "night_begin": "21:29",
44 "sun_status": "-",
45 "solar_noon": "12:59",
46 "day_length": "13:38",
47 "sun_altitude": -32.71416633376341,
48 "sun_distance": 151434594.78783575,
49 "sun_azimuth": 26.024901504053787,
50 "moon_phase": "FIRST_QUARTER",
51 "moonrise": "13:46",
52 "moonset": "23:03",
53 "moon_status": "-",
54 "moon_altitude": -42.49296707204512,
55 "moon_distance": 398756.08075430215,
56 "moon_azimuth": 277.1293216722035,
57 "moon_parallactic_angle": 54.09742095502767,
58 "moon_illumination_percentage": "41.76",
59 "moon_angle": 80.51291351285019
60 }
61}You can pass any IPv4 or IPv6 address as a query parameter to get the astronomical information.
Full API Docscurl 'https://api.ipgeolocation.io/v3/astronomy?apiKey=API_KEY&ip=8.8.8.8'1{
2 "ip": "8.8.8.8",
3 "location": {
4 "continent_code": "NA",
5 "continent_name": "North America",
6 "country_code2": "US",
7 "country_code3": "USA",
8 "country_name": "United States",
9 "country_name_official": "United States of America",
10 "is_eu": false,
11 "state_prov": "California",
12 "state_code": "US-CA",
13 "district": "Santa Clara",
14 "city": "Mountain View",
15 "zipcode": "94043-1351",
16 "latitude": "37.42240",
17 "longitude": "-122.08421",
18 "locality": "Charleston Terrace",
19 "elevation": "3"
20 },
21 "astronomy": {
22 "date": "2026-08-18",
23 "current_time": "23:30:49.394",
24 "mid_night": "01:12",
25 "night_end": "04:51",
26 "morning": {
27 "astronomical_twilight_begin": "04:51",
28 "astronomical_twilight_end": "05:26",
29 "nautical_twilight_begin": "05:26",
30 "nautical_twilight_end": "05:59",
31 "civil_twilight_begin": "05:59",
32 "civil_twilight_end": "06:27",
33 "blue_hour_begin": "05:48",
34 "blue_hour_end": "06:10",
35 "golden_hour_begin": "06:10",
36 "golden_hour_end": "07:02"
37 },
38 "sunrise": "06:27",
39 "sunset": "19:56",
40 "evening": {
41 "golden_hour_begin": "19:21",
42 "golden_hour_end": "20:13",
43 "blue_hour_begin": "20:13",
44 "blue_hour_end": "20:34",
45 "civil_twilight_begin": "19:56",
46 "civil_twilight_end": "20:24",
47 "nautical_twilight_begin": "20:24",
48 "nautical_twilight_end": "20:57",
49 "astronomical_twilight_begin": "20:57",
50 "astronomical_twilight_end": "21:31"
51 },
52 "night_begin": "21:31",
53 "sun_status": "-",
54 "solar_noon": "13:12",
55 "day_length": "13:29",
56 "sun_altitude": -34.48879897137453,
57 "sun_distance": 151463523.8002413,
58 "sun_azimuth": 329.6122289407368,
59 "moon_phase": "FIRST_QUARTER",
60 "moonrise": "12:53",
61 "moonset": "22:56",
62 "moon_status": "-",
63 "moon_altitude": -5.922608527787727,
64 "moon_distance": 398761.87255631835,
65 "moon_azimuth": 247.00209767619168,
66 "moon_parallactic_angle": 51.938577749147456,
67 "moon_illumination_percentage": "41.77",
68 "moon_angle": 80.52950433349721
69 }
70}Four groups of fields provide a complete view of astronomical events for any point and time on Earth.
Every response resolves the place you asked about: city, state, country, coordinates, and elevation. Ask by IP and the API geolocates it first; ask by address and it geocodes it. Times come back in that location's own time zone.
See the Astronomy API documentation for a complete field-by-field reference
Four groups of fields cover the sky for any point on Earth. The docs list every field.
Today
84.31%
View the full moon fields reference in the Astronomy API documentation.
The Astronomy API computes Sun and Moon events from their position relative to your local horizon, using your coordinates, date, elevation, and time zone to produce accurate local event times.
One honest caveat: no provider can promise observed rise times to the second, because refraction bends with that day's atmosphere. The USNO notes computed times can differ from observation by a minute or more, longer at high latitudes. We compute the convention precisely and say so plainly.
Pass date and the same request returns any past or future day. Need a range? The timeSeries endpoint returns up to 90 days of sunrise, sunset, twilight, and moon data in a single call, one row per day, for calendars, almanac features, and solar planning.
curl -X GET 'https://api.ipgeolocation.io/v3/astronomy/timeSeries?apiKey=<YOUR_API_KEY>&lat=40.76473&long=-74.00084&dateStart=2026-08-18&dateEnd=2026-08-20'1{
2 "location": {
3 "latitude": "40.76473",
4 "longitude": "-74.00084",
5 "country_name": "United States",
6 "state_prov": "New York",
7 "city": "New York",
8 "locality": "Midtown West",
9 "elevation": "9"
10 },
11 "astronomy": [
12 {
13 "date": "2026-08-18",
14 "mid_night": "01:00",
15 "night_end": "04:27",
16 "morning": {
17 "astronomical_twilight_begin": "04:27",
18 "astronomical_twilight_end": "05:04",
19 "nautical_twilight_begin": "05:04",
20 "nautical_twilight_end": "05:40",
21 "civil_twilight_begin": "05:40",
22 "civil_twilight_end": "06:08",
23 "blue_hour_begin": "05:28",
24 "blue_hour_end": "05:51",
25 "golden_hour_begin": "05:51",
26 "golden_hour_end": "06:46"
27 },
28 "sunrise": "06:08",
29 "sunset": "19:50",
30 "evening": {
31 "golden_hour_begin": "19:12",
32 "golden_hour_end": "20:07",
33 "blue_hour_begin": "20:07",
34 "blue_hour_end": "20:30",
35 "civil_twilight_begin": "19:50",
36 "civil_twilight_end": "20:18",
37 "nautical_twilight_begin": "20:18",
38 "nautical_twilight_end": "20:53",
39 "astronomical_twilight_begin": "20:53",
40 "astronomical_twilight_end": "21:31"
41 },
42 "night_begin": "21:31",
43 "sun_status": "-",
44 "solar_noon": "12:59",
45 "day_length": "13:41",
46 "moon_phase": "FIRST_QUARTER",
47 "moonrise": "12:41",
48 "moonset": "22:31",
49 "moon_status": "-"
50 },
51 {
52 "date": "2026-08-19",
53 "mid_night": "00:59",
54 "night_end": "04:28",
55 "morning": {
56 "astronomical_twilight_begin": "04:28",
57 "astronomical_twilight_end": "05:06",
58 "nautical_twilight_begin": "05:06",
59 "nautical_twilight_end": "05:41",
60 "civil_twilight_begin": "05:41",
61 "civil_twilight_end": "06:09",
62 "blue_hour_begin": "05:29",
63 "blue_hour_end": "05:52",
64 "golden_hour_begin": "05:52",
65 "golden_hour_end": "06:47"
66 },
67 "sunrise": "06:09",
68 "sunset": "19:48",
69 "evening": {
70 "golden_hour_begin": "19:11",
71 "golden_hour_end": "20:05",
72 "blue_hour_begin": "20:05",
73 "blue_hour_end": "20:28",
74 "civil_twilight_begin": "19:48",
75 "civil_twilight_end": "20:17",
76 "nautical_twilight_begin": "20:17",
77 "nautical_twilight_end": "20:52",
78 "astronomical_twilight_begin": "20:52",
79 "astronomical_twilight_end": "21:29"
80 },
81 "night_begin": "21:29",
82 "sun_status": "-",
83 "solar_noon": "12:59",
84 "day_length": "13:39",
85 "moon_phase": "FIRST_QUARTER",
86 "moonrise": "13:46",
87 "moonset": "23:03",
88 "moon_status": "-"
89 },
90 {
91 "date": "2026-08-20",
92 "mid_night": "00:59",
93 "night_end": "04:30",
94 "morning": {
95 "astronomical_twilight_begin": "04:30",
96 "astronomical_twilight_end": "05:07",
97 "nautical_twilight_begin": "05:07",
98 "nautical_twilight_end": "05:42",
99 "civil_twilight_begin": "05:42",
100 "civil_twilight_end": "06:10",
101 "blue_hour_begin": "05:30",
102 "blue_hour_end": "05:53",
103 "golden_hour_begin": "05:53",
104 "golden_hour_end": "06:48"
105 },
106 "sunrise": "06:10",
107 "sunset": "19:47",
108 "evening": {
109 "golden_hour_begin": "19:09",
110 "golden_hour_end": "20:04",
111 "blue_hour_begin": "20:04",
112 "blue_hour_end": "20:27",
113 "civil_twilight_begin": "19:47",
114 "civil_twilight_end": "20:15",
115 "nautical_twilight_begin": "20:15",
116 "nautical_twilight_end": "20:50",
117 "astronomical_twilight_begin": "20:50",
118 "astronomical_twilight_end": "21:27"
119 },
120 "night_begin": "21:27",
121 "sun_status": "-",
122 "solar_noon": "12:59",
123 "day_length": "13:36",
124 "moon_phase": "FIRST_QUARTER",
125 "moonrise": "14:48",
126 "moonset": "23:41",
127 "moon_status": "-"
128 }
129 ]
130}See the Astronomy API documentation for a complete field-by-field reference
Daily prayer schedules are anchored to the sun: dawn and dusk prayers to twilight boundaries, midday to solar noon, sunset prayers to the sunset itself. The API returns each boundary per location per date for a perfect prayer times app.
Golden hour and blue hour windows, per date, per location, in local time. A photo-planning app can tell a photographer in Santorini exactly when the light turns and how long it lasts, from one request made with nothing more than the town's name.
sun_altitude and sun_azimuth by street address make panel orientation a lookup instead of a site survey. Pull a 90-day timeSeries to model seasonal sun paths, estimate yield windows, and point fixed installations where the payback math says they should face.
Lights at sunset, blinds at golden hour, irrigation before dawn. Because the API accepts an IP address, a hub can schedule against real local sun times with no GPS hardware and no user setup, and re-resolve automatically when the device changes networks.
Day length and daylight windows by city power safe-hiking cutoffs, sunrise summit alerts, and itinerary planning. Add moonrise, moonset, and phase for stargazing features: a WANING_CRESCENT sky is dark enough for the Milky Way, a FULL_MOON night is not.
time_zone parameter with any IANA name, and timestamps then include the full date.date parameter returns any single past or future date, and the timeSeries endpoint returns up to 90 days in one call: pass dateStart and dateEnd with your location and you get one entry per day, covering sun, twilight, and moon fields. It is the practical way to build calendars and seasonal charts.sun_status reads "Always above the twilight angle" or "Always below the twilight angle". The moon behaves the same way through moon_status . Your code can branch on the status fields rather than parsing sentinel times.ip parameter, or with no parameter to use the caller's own IP. The API geolocates the address, resolves its time zone, and returns sunrise, sunset, twilight, and moon data for that place in local time. One request does the whole chain: no separate geolocation lookup, no coordinate handling.elevation tightens results for observers above sea level. For details, see our practical guide.Sunrise to moonset in one request. Get sun, moon, twilight, and golden hour data for any place and date on Earth, backed by a 99.99% uptime SLA. No credit card required.
Get the latest in geolocation tech, straight to your inbox.