Astronomy API

GET

https://api.apifreaks.com/v1.0/geolocation/astronomy

format
Format of the Response
locationString
Extract astronomy informatin using location (preferably city)
latInteger
Latitude to extract timezone informatin using location coordinates
longInteger
Longitude to extract timezone informatin using location coordinates
ipString
IPv4 or IPv6 address to extract timezone informatin using IP address
langString
response language of "location" field in case of lookup through IP address only.
dateString
Specific date (format YYYY-MM-DD) for which astronomy data is required

Sample Responses

400
400
400
LANGUAGE
Python
PHP
Java
Node
Ruby
$ pip install requests
RESPONSE

Click Test it to start the request and see the response here!


API Response

Here are the response fields when performing a lookup using geographical coordinates (latitude and longitude):

FieldTypeRequirementDescription
dateStringMandatory
The current date
current_timeStringMandatory
The current time
sunriseStringOptional
The time of sunrise
sunsetStringOptional
The time of sunset
sun_statusStringOptional
The current status of the sun (e.g., "rising", "setting")
solar_noonStringOptional
The time of solar noon
day_lengthStringOptional
The length of the day
sun_altitudeFloatMandatory
The altitude angle of the sun above the horizon
sun_distanceFloatMandatory
The distance from the Earth to the sun
sun_azimuthFloatMandatory
The azimuth angle of the sun
moonriseStringOptional
The time of moonrise
moonsetStringOptional
The time of moonset
moon_statusStringOptional
The current status of the moon (e.g., "rising", "setting")
moon_altitudeFloatMandatory
The altitude angle of the moon above the horizon
moon_distanceFloatMandatory
The distance from the Earth to the moon
moon_azimuthFloatMandatory
The azimuth angle of the moon
moonparallacticangleFloatMandatory
The parallactic angle of the moon
location.latitudeFloatMandatory
The latitude coordinate of the location
location.longitudeFloatMandatory
The longitude coordinate of the location

When a lookup is performed using the 'location' parameter, the following additional fields are appended to the above fields:

FieldTypeRequirementDescription
location.locationStringMandatory
The complete geographical location, including country, state, city, and locality
location.countryStringOptional
The country of the geographical location
location.stateStringOptional
The state of the geographical location
location.cityStringOptional
The city of the geographical location
location.localityStringOptional
The locality or neighborhood of the geographical location

When no parameters or IP address are provided, the user's current location is detected. If a parameter is provided, the IP location is used. The following fields are appended to the previously mentioned fields:

FieldTypeRequirementDescription
geo.country_code2StringMandatory
The 2-letter country code (ISO 3166-1 alpha-2)
geo.country_code3StringMandatory
The 3-letter country code (ISO 3166-1 alpha-3)
geo.country_nameStringMandatory
The common name of the country
geo.country_name_officialStringMandatory
The official name of the country
geo.state_provStringOptional
The state or province of the geographical location
geo.state_codeStringOptional
The code for the state or province
geo.districtStringOptional
The district of the geographical location
geo.cityStringOptional
The city of the geographical location
geo.zip_codeStringOptional
The postal code of the geographical location