Included in
Advance PlanSecurity PlanStandard PlanFree PlanAstronomy API
The Astronomy API provides the location-based rise and set times for the Sun and Moon along with the current position, distance from earth, and azimuth of the Sun and the Moon for a specific date at the queried time.
The Astronomy calculations are much more complex than producing an accurate result from obscure formulas throwing in a few numbers. There is always a tradeoff between the accuracy and computing time. Our Astronomy API focuses more on producing an acceptable results and has an accuracy of around one minute that is good enough for applications like sunrise/sunset timers but is not sufficient for astronomical purposes.
There are three ways to consume the Astronomy API:
- Using any Location Address (preferrably, city address)
- Using Geo Coordinates (latitude & longitude)
- Using any IPv4 or IPv6 address
The three variations of Astronomy API take the different input sources to produce astronomical information along with location details. Here is how to consume each variation:
Getting Astronomical Information for an Address
You can pass the address of a location as query parameters location
to get the astronomical information. Here is an example to get the astronomical information for address 'New York, US':
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy?apiKey=API_KEY&location=New%20York%2C%20US&elevation=10'
1{
2 "location": {
3 "location_string": "New York, US",
4 "country_name": "United States",
5 "state_prov": "New York",
6 "city": "New York",
7 "locality": "Clinton",
8 "latitude": "40.76473",
9 "longitude": "-74.00084",
10 "elevation": "9"
11 },
12 "astronomy": {
13 "date": "2025-07-17",
14 "current_time": "09:10:58.985",
15 "mid_night": "01:02",
16 "night_end": "03:40",
17 "morning": {
18 "astronomical_twilight_begin": "03:40",
19 "astronomical_twilight_end": "04:27",
20 "nautical_twilight_begin": "04:27",
21 "nautical_twilight_end": "05:07",
22 "civil_twilight_begin": "05:07",
23 "civil_twilight_end": "05:38",
24 "blue_hour_begin": "04:54",
25 "blue_hour_end": "05:20",
26 "golden_hour_begin": "05:20",
27 "golden_hour_end": "06:19"
28 },
29 "sunrise": "05:38",
30 "sunset": "20:25",
31 "evening": {
32 "golden_hour_begin": "19:44",
33 "golden_hour_end": "20:44",
34 "blue_hour_begin": "20:44",
35 "blue_hour_end": "21:09",
36 "civil_twilight_begin": "20:25",
37 "civil_twilight_end": "20:56",
38 "nautical_twilight_begin": "20:56",
39 "nautical_twilight_end": "21:37",
40 "astronomical_twilight_begin": "21:37",
41 "astronomical_twilight_end": "22:23"
42 },
43 "night_begin": "22:23",
44 "sun_status": "-",
45 "solar_noon": "13:02",
46 "day_length": "14:46",
47 "sun_altitude": 37.684583665337136,
48 "sun_distance": 152059278.33947453,
49 "sun_azimuth": 93.76489195520992,
50 "moon_phase": "LAST_QUARTER",
51 "moonrise": "-:-",
52 "moonset": "13:04",
53 "moon_status": "-",
54 "moon_altitude": 41.1571204832521,
55 "moon_distance": 371602.01272168546,
56 "moon_azimuth": 242.83522002195667,
57 "moon_parallactic_angle": 43.133797802809234,
58 "moon_illumination_percentage": "-55.46",
59 "moon_angle": 263.73075577837375
60 }
61}
Location details like country name, state/province name, and city are provided in the response for the provided location that can be used for multiple purposes.
elevation
is an optional parameter of type double
, with a default value of 0 meter
and a maximum value of 10,000 meters. Negative value is set to 0.
Getting Astronomical Information for Location Coordinates
You can pass the latitude and longitude of a location as query parameters lat
and long
to get the astronomical information. Here is an example to get the astronomical information for '-27.4748, 153.017' coordinates:
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy?apiKey=API_KEY&lat=40.76473&long=-74.00084&elevation=10'
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": "2025-07-17",
13 "current_time": "09:25:24.976",
14 "mid_night": "01:02",
15 "night_end": "03:40",
16 "morning": {
17 "astronomical_twilight_begin": "03:40",
18 "astronomical_twilight_end": "04:27",
19 "nautical_twilight_begin": "04:27",
20 "nautical_twilight_end": "05:07",
21 "civil_twilight_begin": "05:07",
22 "civil_twilight_end": "05:38",
23 "blue_hour_begin": "04:54",
24 "blue_hour_end": "05:20",
25 "golden_hour_begin": "05:20",
26 "golden_hour_end": "06:19"
27 },
28 "sunrise": "05:38",
29 "sunset": "20:25",
30 "evening": {
31 "golden_hour_begin": "19:44",
32 "golden_hour_end": "20:44",
33 "blue_hour_begin": "20:44",
34 "blue_hour_end": "21:09",
35 "civil_twilight_begin": "20:25",
36 "civil_twilight_end": "20:56",
37 "nautical_twilight_begin": "20:56",
38 "nautical_twilight_end": "21:37",
39 "astronomical_twilight_begin": "21:37",
40 "astronomical_twilight_end": "22:23"
41 },
42 "night_begin": "22:23",
43 "sun_status": "-",
44 "solar_noon": "13:02",
45 "day_length": "14:46",
46 "sun_altitude": 40.40556745814887,
47 "sun_distance": 152059278.33947453,
48 "sun_azimuth": 96.31786706454017,
49 "moon_phase": "LAST_QUARTER",
50 "moonrise": "-:-",
51 "moonset": "13:04",
52 "moon_status": "-",
53 "moon_altitude": 38.81892898270342,
54 "moon_distance": 371583.23898603366,
55 "moon_azimuth": 246.127223965273,
56 "moon_parallactic_angle": 44.656760778604536,
57 "moon_illumination_percentage": "-55.35",
58 "moon_angle": 263.8619397916658
59 }
60}
Getting Astronomical Information for an IPv4 or IPv6 Address
You can pass any IPv4 or IPv6 address as a query parameter ip
to get the astronomical information. Here is an example to get the astronomical information for the IP address '8.8.8.8':
curl -X GET 'https://api.ipgeolocation.io/v2/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": "2025-07-18",
23 "current_time": "03:06:31.046",
24 "mid_night": "01:14",
25 "night_end": "04:14",
26 "morning": {
27 "astronomical_twilight_begin": "04:14",
28 "astronomical_twilight_end": "04:54",
29 "nautical_twilight_begin": "04:54",
30 "nautical_twilight_end": "05:32",
31 "civil_twilight_begin": "05:32",
32 "civil_twilight_end": "06:01",
33 "blue_hour_begin": "05:20",
34 "blue_hour_end": "05:43",
35 "golden_hour_begin": "05:43",
36 "golden_hour_end": "06:39"
37 },
38 "sunrise": "06:01",
39 "sunset": "20:27",
40 "evening": {
41 "golden_hour_begin": "19:49",
42 "golden_hour_end": "20:45",
43 "blue_hour_begin": "20:45",
44 "blue_hour_end": "21:09",
45 "civil_twilight_begin": "20:27",
46 "civil_twilight_end": "20:56",
47 "nautical_twilight_begin": "20:56",
48 "nautical_twilight_end": "21:34",
49 "astronomical_twilight_begin": "21:34",
50 "astronomical_twilight_end": "22:14"
51 },
52 "night_begin": "22:14",
53 "sun_status": "-",
54 "solar_noon": "13:14",
55 "day_length": "14:25",
56 "sun_altitude": -25.97691496384962,
57 "sun_distance": 152051279.32455352,
58 "sun_azimuth": 29.157153500526988,
59 "moon_phase": "LAST_QUARTER",
60 "moonrise": "00:23",
61 "moonset": "14:34",
62 "moon_status": "-",
63 "moon_altitude": 31.341933591493504,
64 "moon_distance": 370142.7870275993,
65 "moon_azimuth": 94.69006597321885,
66 "moon_parallactic_angle": -55.06382574132873,
67 "moon_illumination_percentage": "-45.47",
68 "moon_angle": 275.1982227377768
69 }
70}
When you get the astronomical information through an IP address, API will also return the extra fields about place information along with the astronomical information.
Getting Astronomical Information for the required Time Zone
The API's default behavior is to return all dates based on the time zone of the provided location. To analyze dates according to your desired time zone, use the time_zone
parameter as follows:
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy?apiKey=API_KEY&lat=40.76473&long=-74.00084&time_zone=Europe%2FLondon'
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 "time_zone": "Europe/London",
13 "date": "2025-07-17",
14 "current_time": "15:44:42.074",
15 "mid_night": "2025-07-17 06:02",
16 "night_end": "2025-07-17 08:40",
17 "morning": {
18 "astronomical_twilight_begin": "2025-07-17 08:40",
19 "astronomical_twilight_end": "2025-07-17 09:27",
20 "nautical_twilight_begin": "2025-07-17 09:27",
21 "nautical_twilight_end": "2025-07-17 10:07",
22 "civil_twilight_begin": "2025-07-17 10:07",
23 "civil_twilight_end": "2025-07-17 10:39",
24 "blue_hour_begin": "2025-07-17 09:54",
25 "blue_hour_end": "2025-07-17 10:20",
26 "golden_hour_begin": "2025-07-17 10:20",
27 "golden_hour_end": "2025-07-17 11:19"
28 },
29 "sunrise": "2025-07-17 10:39",
30 "sunset": "2025-07-18 01:25",
31 "evening": {
32 "golden_hour_begin": "2025-07-18 00:44",
33 "golden_hour_end": "2025-07-18 01:44",
34 "blue_hour_begin": "2025-07-18 01:44",
35 "blue_hour_end": "2025-07-18 02:09",
36 "civil_twilight_begin": "2025-07-18 01:25",
37 "civil_twilight_end": "2025-07-18 01:56",
38 "nautical_twilight_begin": "2025-07-18 01:56",
39 "nautical_twilight_end": "2025-07-18 02:37",
40 "astronomical_twilight_begin": "2025-07-18 02:37",
41 "astronomical_twilight_end": "2025-07-18 03:23"
42 },
43 "night_begin": "2025-07-18 03:23",
44 "sun_status": "-",
45 "solar_noon": "2025-07-17 18:02",
46 "day_length": "14:46",
47 "sun_altitude": 54.88652737781637,
48 "sun_distance": 152059278.33947453,
49 "sun_azimuth": 113.61353349876049,
50 "moon_phase": "LAST_QUARTER",
51 "moonrise": "-:-",
52 "moonset": "2025-07-17 18:04",
53 "moon_status": "-",
54 "moon_altitude": 25.142018876738202,
55 "moon_distance": 371480.8881612358,
56 "moon_azimuth": 261.5480830860141,
57 "moon_parallactic_angle": 49.55994680103275,
58 "moon_illumination_percentage": "-54.72",
59 "moon_angle": 264.58283761108015
60 }
61}
Time Series Lookup
You can look up astronomy details for any location by providing a starting and ending date for the time series. The API allows a maximum 90-day lookup period, whether for future or past dates. Here's how you can do it.
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy/timeSeries?apiKey=API_KEY&dateStart=2025-06-16&dateEnd=2025-06-18&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 {
13 "date": "2025-06-16",
14 "mid_night": "00:56",
15 "night_end": "03:18",
16 "morning": {
17 "astronomical_twilight_begin": "03:18",
18 "astronomical_twilight_end": "04:08",
19 "nautical_twilight_begin": "04:08",
20 "nautical_twilight_end": "04:50",
21 "civil_twilight_begin": "04:50",
22 "civil_twilight_end": "05:23",
23 "blue_hour_begin": "04:37",
24 "blue_hour_end": "05:04",
25 "golden_hour_begin": "05:04",
26 "golden_hour_end": "06:05"
27 },
28 "sunrise": "05:23",
29 "sunset": "20:30",
30 "evening": {
31 "golden_hour_begin": "19:48",
32 "golden_hour_end": "20:49",
33 "blue_hour_begin": "20:49",
34 "blue_hour_end": "21:16",
35 "civil_twilight_begin": "20:30",
36 "civil_twilight_end": "21:03",
37 "nautical_twilight_begin": "21:03",
38 "nautical_twilight_end": "21:45",
39 "astronomical_twilight_begin": "21:45",
40 "astronomical_twilight_end": "22:36"
41 },
42 "night_begin": "22:36",
43 "sun_status": "-",
44 "solar_noon": "12:56",
45 "day_length": "15:06",
46 "moon_phase": "WANING_GIBBOUS",
47 "moonrise": "-:-",
48 "moonset": "10:28",
49 "moon_status": "-"
50 },
51 {
52 "date": "2025-06-17",
53 "mid_night": "00:56",
54 "night_end": "03:17",
55 "morning": {
56 "astronomical_twilight_begin": "03:17",
57 "astronomical_twilight_end": "04:08",
58 "nautical_twilight_begin": "04:08",
59 "nautical_twilight_end": "04:50",
60 "civil_twilight_begin": "04:50",
61 "civil_twilight_end": "05:23",
62 "blue_hour_begin": "04:37",
63 "blue_hour_end": "05:04",
64 "golden_hour_begin": "05:04",
65 "golden_hour_end": "06:05"
66 },
67 "sunrise": "05:23",
68 "sunset": "20:30",
69 "evening": {
70 "golden_hour_begin": "19:48",
71 "golden_hour_end": "20:50",
72 "blue_hour_begin": "20:50",
73 "blue_hour_end": "21:17",
74 "civil_twilight_begin": "20:30",
75 "civil_twilight_end": "21:03",
76 "nautical_twilight_begin": "21:03",
77 "nautical_twilight_end": "21:46",
78 "astronomical_twilight_begin": "21:46",
79 "astronomical_twilight_end": "22:36"
80 },
81 "night_begin": "22:36",
82 "sun_status": "-",
83 "solar_noon": "12:57",
84 "day_length": "15:06",
85 "moon_phase": "LAST_QUARTER",
86 "moonrise": "00:23",
87 "moonset": "11:38",
88 "moon_status": "-"
89 },
90 {
91 "date": "2025-06-18",
92 "mid_night": "00:57",
93 "night_end": "03:18",
94 "morning": {
95 "astronomical_twilight_begin": "03:18",
96 "astronomical_twilight_end": "04:08",
97 "nautical_twilight_begin": "04:08",
98 "nautical_twilight_end": "04:51",
99 "civil_twilight_begin": "04:51",
100 "civil_twilight_end": "05:23",
101 "blue_hour_begin": "04:37",
102 "blue_hour_end": "05:04",
103 "golden_hour_begin": "05:04",
104 "golden_hour_end": "06:05"
105 },
106 "sunrise": "05:23",
107 "sunset": "20:31",
108 "evening": {
109 "golden_hour_begin": "19:49",
110 "golden_hour_end": "20:50",
111 "blue_hour_begin": "20:50",
112 "blue_hour_end": "21:17",
113 "civil_twilight_begin": "20:31",
114 "civil_twilight_end": "21:03",
115 "nautical_twilight_begin": "21:03",
116 "nautical_twilight_end": "21:46",
117 "astronomical_twilight_begin": "21:46",
118 "astronomical_twilight_end": "22:37"
119 },
120 "night_begin": "22:37",
121 "sun_status": "-",
122 "solar_noon": "12:57",
123 "day_length": "15:07",
124 "moon_phase": "LAST_QUARTER",
125 "moonrise": "00:46",
126 "moonset": "12:49",
127 "moon_status": "-"
128 }
129 ]
130}
All other parameters are the same as for a single-date lookup.
Using Client or Machine IP Address
You can call the astronomy API without passing any coordinates or IP address as well. It will use the calling machine's IP address to return the regional astronomical information. Here is an example:
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy?apiKey=API_KEY'
Astronomy details are calculated based on the following rules:
- Parameters considered: latitude & longitude, location, and IP.
- If all parameters are provided, latitude & longitude are preferred.
- Between location and IP, location is preferred.
- If no parameters are provided, the client’s IP address is used.
Response in Multiple Languages
The astronomy information lookup using an IP address can include geolocation information in the following languages:
- English (en)
- German (de)
- Russian (ru)
- Japanese (ja)
- French (fr)
- Chinese Simplified (cn)
- Spanish (es)
- Czech (cs)
- Italian (it)
- Korean (ko)
- Persian (fa)
- Portuguese (pt)
By default, the API responds in English. But you can change the response language by passing the language code as a query parameter lang
. Here is an example:
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy?apiKey=API_KEY&ip=1.1.1.1&lang=cn'
Getting Astronomical Information for a Specific Date
Along with the above two variations, there is a third variation that you can get the astronomical information for a specific date. You can pass date
query parameter with the date value. Here are some example calls for coordinates search along with date:
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy?apiKey=API_KEY&lat=-27.4748&long=153.017&date=2025-01-01'
Alternatively, you can also call this endpoint with ip address and date parameters:
curl -X GET 'https://api.ipgeolocation.io/v2/astronomy?apiKey=API_KEY&ip=1.1.1.1&date=2025-01-01'
What's New in /v2/astronomy
Below are the key updates introduced in the /v2/astronomy
API endpoint compared to the previous /astronomy
version:
- All astronomy-related data is now grouped under a single
astronomy
object, making the response more consistent with our overall API structure. - When calling
/v2/astronomy
without any parameters or withip=
, the response now includes anip
field to indicate the IP address used for the lookup. - When the
location=
parameter is used, thelocation
object now follows the same field naming conventions as in IP-based queries for consistency across responses:location.location
→location.location_string
location.country
→location.country_name
location.state
→location.state_prov
Reference to Astronomy API Response
Below we have provided separate tables for location
object and astronomy
object fields that can be returned by Astronomy API.
• Standalone fields reference
Field | Type | Description | Can be empty? |
---|---|---|---|
ip | string | The IP address used for the astronomy lookup. Returned when queried using the | Yes |
• location
json object reference
Field | Type | Description | Can be empty? |
---|---|---|---|
location_string | string | Location is the string, you provided for searching. | Yes |
continent_code | string | 2-letter code of the continent. | Yes |
continent_name | string | Name of the continent. | Yes |
country_code2 | string | Country code (ISO 3166-1 alpha-2) of the country. | Yes |
country_code3 | string | Country code (ISO 3166-1 alpha-3) of the country. | Yes |
country_name | string | Name of the country. | Yes |
country_name_official | string | Formal name of the country. | Yes |
is_eu | boolean | Is the country belong to European Union? | Yes |
state_prov | string | Name of the state/province/region. | Yes |
state_code | string | Code of the state/province/region. | Yes |
district | string | Name of the district or county. | Yes |
city | string | Name of the city. | Yes |
locality | string | Smaller area, part or region of a city. | Yes |
zipcode | string | ZIP/Postal code of the place. | Yes |
latitude | float | Latitude of the place. | No |
longitude | float | Longitude of the place. | No |
elevation | string | Elevation above sea level at the location, in meters. | Yes |
• astronomy
json object reference
Field | Type | Description | Can be empty? |
---|---|---|---|
time_zone | string | Appears (with the provided value) only when the user includes a | No |
date | string | Provided or current date in the format | No |
current_time | string | Current time of the extracted location in the format | No |
mid_night | string | Astronomical midnight (nadir) for the given date. | No |
night_end | string | End of night / start of astronomical twilight (morning). | No |
night_begin | string | Start of night / end of astronomical twilight (evening). | No |
sunrise | string | Time at which sun rises at the extracted location in the format | No |
sunset | string | Time at which sun sets at the extracted location in the format | No |
sun_status | string | Represents the sun rise and sun set status. | No |
solar_noon | string | The time of day when the sun is at its highest point in the sky, in the format | No |
day_length | string | The total length of daylight for the current day in format | No |
sun_altitude | float | The sun's altitude angle above the horizon at | No |
sun_distance | float | The distance from Earth to the sun at | No |
sun_azimuth | float | The azimuth angle of the sun at | No |
moonrise | string | Time at which moon rises at the extracted location in the format | No |
moonset | string | Time at which moon sets at the extracted location in the format | No |
moon_status | string | Represents the moon rise and moon set status. | No |
moon_altitude | float | The moon's altitude angle above the horizon at | No |
moon_distance | float | The distance from Earth to the moon at | No |
moon_azimuth | float | The azimuth angle of the moon at | No |
moon_parallactic_angle | float | The angle between the celestial pole and the moon's position relative to the location, measured in degrees. | No |
moon_phase | string | The current phase of the moon (e.g., | No |
moon_illumination_percentage | string | The percentage of the moon's surface that is illuminated by sunlight, as viewed from Earth. | No |
moon_angle | float | The angular diameter of the moon as observed from Earth, measured in degrees. | No |
morning.astronomical_twilight_begin | string | Start of astronomical twilight (pre‑dawn) in the morning. | No |
morning.astronomical_twilight_end | string | End of astronomical twilight in the morning. | No |
morning.nautical_twilight_begin | string | Start of nautical twilight (when the horizon first becomes visible) in the morning. | No |
morning.nautical_twilight_end | string | End of nautical twilight in the morning. | No |
morning.civil_twilight_begin | string | Start of civil twilight (enough light for outdoor activities) in the morning. | No |
morning.civil_twilight_end | string | End of civil twilight in the morning. | No |
morning.blue_hour_begin | string | Start of blue hour (soft, diffused light) before sunrise. | No |
morning.blue_hour_end | string | End of blue hour before sunrise. | No |
morning.golden_hour_begin | string | Start of golden hour (warm, low‑angle light) before sunrise. | No |
morning.golden_hour_end | string | End of golden hour before sunrise. | No |
evening.golden_hour_begin | string | Start of golden hour (warm, low‑angle light) after sunset. | No |
evening.golden_hour_end | string | End of golden hour after sunset. | No |
evening.blue_hour_begin | string | Start of blue hour (soft, diffused light) after sunset. | No |
evening.blue_hour_end | string | End of blue hour after sunset. | No |
evening.civil_twilight_begin | string | Start of civil twilight (enough light for outdoor activities) in the evening. | No |
evening.civil_twilight_end | string | End of civil twilight in the evening. | No |
evening.nautical_twilight_begin | string | Start of nautical twilight (horizon still visible) in the evening. | No |
evening.nautical_twilight_end | string | End of nautical twilight in the evening. | No |
evening.astronomical_twilight_begin | string | Start of astronomical twilight (night sky begins) in the evening. | No |
evening.astronomical_twilight_end | string | End of astronomical twilight in the evening. | No |
sun_status: - Indicates the current state of the sun relative to the horizon. If both the sunrise
and sunset
values are not equal to "-:-", sun_status
will be set to "-", indicating no special status. If the sun is continuously above the twilight angle, sun_status
may be set to "Always above the twilight angle", indicating perpetual daylight. Conversely, if the sun remains below the twilight angle, the status may read "Always below the twilight angle", indicating that the sun does not rise within the current 24-hour period.
moon_status: - Represents the current state of the moon in relation to the horizon. If both the moonrise
and moonset
values are not equal to "-:-", moon_status
will be set to "-", indicating no special status. If the moon is always visible above the horizon, moon_status
may be assigned "Always above the horizon", signifying that the moon does not set within the current 24-hour period. Conversely, if the moon is consistently below the horizon, it may read "Always below the horizon", indicating it does not rise during this timeframe.
current_time
and duration day_length
) are formatted as yyyy-MM-dd HH:mm
when a time_zone
is provided; otherwise they use HH:mm
.Error Codes
Astronomy API returns HTTP status code 200 for a successful API request along with the response.
While, in case of a bad or invalid request, Astronomy API returns 4xx HTTP status code along with a descriptive message explaining the reason for the error.
Below is a detailed explanation of the specific HTTP status codes and their corresponding error conditions:
HTTP Status | Description |
---|---|
400 Bad Request | It is returned for one of the following reasons:
|
401 Unauthorized | It is returned for one of the following reasons:
|
405 Method Not Allowed |
|
429 Too Many Requests | It is returned for one of the following reasons:
|
499 Client Closed Request |
|
5XX Server Side Error |
|
API SDKs
To facilitate the developers, we have added some SDKs for various programming languages. The detailed documentation on how to use these SDKs is available in the respective SDK's documentation page linked below.
Our SDKs are also available on Github. Feel free to help us improve them. Following are the available SDKs: