API Reference (experimental)

Note that API URLs, parameters and returned data sets may change without advance notice. The supplied data is intended for hobby astronomers and is not verified for scientific applications. The API is restricted to personal and educational use.

 

HIP Stars API

Here is a simple API for programmers who wish to query the HIP stars database in an easy fashion, say, for software applications. Currently, only the Hipparcos Star stars (down to mag 6.5) and Nearby Stars (140 stars) tables are connected to this API.

Syntax: https://www.astropical.space/api.php?table=xxxx&which=xxxx&limit=xxxx&format=csv|xml|json

  • table= either 'stars' for Hipparcos or 'nearby' for Nearby Stars. Other tables are planned to be addressed later depending on demand.
  • which= supported are: magnitude | distance | constellation | spectrum | temperature | radial | mass | radius | catalogs(hip|hd|sao).
  • limit= is the query limit, such as 3 when which=magnitude, to limit output to stars brighter than 3 mag.
  • format= either of: csv | xml | json (CSV if format= is omitted, default)

The data output sequence is:
ID, name, designation, HIP, HD, SAO, constellation, magnitude, distance (ly), radial velocity (km/s), spectrum, color index (bvc), Teff(°K), mass (solar), radius (solar), right ascension (hours decimal), declination (degrees decimal).

Results for nearby stars return empty attributes for HIP, HD and SAO as well as rad (radial velocity), unavailable parameters are either '0' or '-999'.

Recent browsers prohibit loading of local sources. If the returned result shows meaninglessly unformatted text, please open the source (right click: "View page source").

 

Example Calls

The base URL is https://www.astropical.space/

Get all stars in Ursa Minor in CSV

api.php?table=stars&which=constellation&limit=umi&format=csv Try

 

Get all stars down to magnitude 2 in XML

api.php?table=stars&which=magnitude&limit=2&format=xml Try

 

Get all stars up to 32 light-years in JSON

api.php?table=stars&which=distance&limit=32&format=json Try

 

Get all stars of spectral class 'G' in XML

api.php?table=stars&which=spectrum&limit=g&format=xml Try

 

Get all stars with radial velocity above ±100km/s in XML

api.php?table=stars&which=radial&limit=100&format=xml Try

 

Get all stars with mass above 10 solar in CSV

api.php?table=stars&which=mass&limit=10&format=csv Try

 

Get all stars with radius above 10 solar in XML

api.php?table=stars&which=radius&limit=10&format=xml Try

 

Get by star common name in CSV

api.php?table=stars&which=name&limit=alde&format=csv Try
Result is 'Aldebaran' and 'Alderamin'

 

Get by star designation (Bayer or Flamsted) in CSV

api.php?table=stars&which=designation&limit=zet&format=csv Try
Result is all stars with designated 'Zeta'.

 

Get HIP 36850 (Castor) in CSV

api.php?table=stars&which=hip&limit=36850&format=csv Try
In analogy, you may wish to query HD (which=hd), HR (which=hr)
and SAO (which=sao) catalog numbers.

 

Get Nearby stars up to 10 light-years in CSV

api.php?table=nearby&which=distance&limit=10&format=csv Try

 

 

Exoplanets API

This simple API queries the database of NASA's Exoplanet Archive.

Syntax: https://www.astropical.space/api-exo.php?which=xxx&limit=xxx&format=csv|xml|json

  • which= supported are: name | mass [xJ] | radius [xJ] | distance [psc] | period [days] | sma [AU] | disc [year]
  • limit= is the query limit, such as 0.1 when which=mass, to limit output to exoplanets with masses up to 0.1 jovian.
  • format= either of: csv | xml | json (CSV if format= is omitted, default)

Returned exoplanet data sequence is:

id, name, constellation, zone*, class*, mass [J], mass (xE), radius [xJ], radius (xE), semi-major axis [AU], period [days], eccentricity, distance [parsec], right ascension [decimal deg], declination [decimal deg], spectral*, discovery [year], update

* which=spectral expects limit=m (red dwarfs) or limit=g (sun-like), etc.

 

Value = '0' are unknown parameters (ambiguous though with eccentricity). Exoplanets with unknown mass are excluded, currently leaving only 2576 planets out of 5616 in the catalog available for result returns.

Recent browsers prohibit loading of local sources. If the returned result shows meaninglessly unformatted text, please open the source (right click: "View page source").

 

Example Calls:

The base URL is https://www.astropical.space/

Get all exoplanets with up to 0.1 Jovian masses in CSV

api-exo.php?which=mass&limit=0.05&format=csv Try

 

Get GJ 625 b in XML

api-exo.php?which=name&limit=gj 625 b&format=xml Try

 

Get all exoplanets up to 0.2 Jovian radii in JSON

api-exo.php?which=radius&limit=0.2&format=json Try

 

Get all TRAPPIST planets in XML

api-exo.php?which=name&limit=trappist&format=xml Try

 

Get all planets up to 10 parsec in CSV

api-exo.php?which=distance&limit=10&format=csv Try

 

Get all planets around an M-type star in CSV

api-exo.php?which=spectral&limit=m&format=csv Try

 

Code Examples Exoplanets

 

Planet Ephemerides

This call returns the current ephemerides of the solar system planets including Pluto. Parameters required are local latitude and longitude in decimal degrees, unless hour angle, azimuth and altitude are not used. If omitted, the coordinates of Tokyo will be used by default.

Code Example Planets


API Call Return Example

api-ephem.php?lat=35&lon=139 Try

 

JSON Data Structure

{"info":
{
	"timestamp": 1524405148,       UNIX time
	"latitude": 35,
	"longitude": 139,
	"eclinc":23.4368968874,        Ecliptic inclination in degrees
	"jd": 2458231.0781019,         Julian date
	"epoch": 0.18305487338404,     Julian centuries
	"lst": 12.379553451742         Local sidereal time in hours
},
"response": [
{
  "id":1,                 Index number
  "name":"Mercury",       Planet name
  "const":"Pisces",       Constellation
  "au_earth":0.6491,      Distance to Earth in AU
  "au_sun":0.4580,        Distance to Sun in AU
  "phase":129.18,         Phase angle in degrees
  "mag":1.61,             Visual magnitude
  "size":10.35,           Angular diameter in arc sec
  "vel":39.78,            Orbital velocity in km/s
  "lt":0.1020,            Light time in hours decimal
  "lt_hms":"00h06m17.9s", Light time in formatted hours
  "ra":7.110312,          Right ascension in degrees
  "de":0.893185,          Declination in degrees
  "ra_hms":"00h32m20s",   Right ascension in sexagesimal
  "de_dms":"01°03'52"",   Declination in sexagesimal
  "glat":112.41,          Galactic latitude in degrees
  "glon":-61.50,          Galactic longitude in degrees
  "elat":-2.23,           Ecliptic latitude in degrees
  "elon":7.85,            Ecliptic longitude in degrees
  "ha":-11.2097,          Hour angle in hours  
  "el":20.72,             Elongation in degrees
  "azm":333.12,           Azimuth in degrees
  "alt":-50.43,           Altitude in degrees
  "ele":56.34,            Max elevation in degrees
  "cm":114.08,            Central meridian in degrees
  "rot":331.58,           Rotation axis angle in degrees
  "pde":-4.25,            Sub-Earth declination in degrees
  "angs":69.88,           Sun diameter in arc min
  "ange":27.10            Earth diameter in arc sec
},
{
.... Venus
}   
]
}

 

Star Charts

The base URL is https://www.astropical.space/

 

Equatorial Chart

The following code returns a star chart image in PNG format centered on Proxima Centauri:
Example: starchart.php?width=1280&height=720&fov=60&rc=217.429&dc=-62.6794 Try

 

width:	chart width in pixels
height: chart height in pixels
fov:	field of view in degrees
rc:	right ascension in degrees decimal
dc:	declination in degrees decimal

 

Planisphere

The following code returns a planisphere for Tokyo:
Example: starchart.php?planis=1&lat=35&lon=139&width=1280 Try

 

planis:	1 for planisphere
lat:	geographic latitude in degrees decimal
lat:	geographic longitude in degrees decimal
width:	diameter in pixels

 

Both Charts

Objects and parameters can be added to either chart. Omit or set &xxx=0 to hide:
Example: starchart.php?width=1280&height=720&fov=60&rc=90&dc=0&cld=1&ngc=1&mes=1 Try

 

&mes=1:		adds 110 Messier objects (1 by default)
&cld=1:		adds 109 Caldwell objects (0 by default)
&ngc=1:		adds about 100 bright NGC/IC objects (0 by default)
&solsys=1:	adds solar system planets (1 by default)
&print=1:	inversed chart for printing (0 by default)

 

 

Leave a Comment

Only in case you expect a reply. Will not be published.


Comments

Eli
[10] 2023-04-08 01:21:28
Hello, My name is Eli I am writing in regards to the API information im working on a project that involves the fixed star Algol im using an Apple Device and im trying to create a shortcut that recalls the information so i can create a data base for a NFT project i want to make that animates the Star in a visually pleasing way any information would be greatly appreciated. My one follow up question in regards to the API for Algol (https://www.astropical.space/algol.php) as the base for the API recall commands ? Im a little rusty but understand enough for people not to hold back when explaining LOL thank you for reading this email kind Regards, Best Wishes Eli B