Stars API
The Stars API provides key statistics for thousands of stars discovered in the known universe.
/v1/stars GET
https://api.api-ninjas.com/v1/stars
Get a list of stars matching specified parameters. Returns at most 30 results. To access more than 30 results, use the offset parameter to offset results in multiple API calls.
Parameters
At least one of the following parameters (other than offset) is required.
- nameoptional- The name of the star. Note that many of the star names contain Greek characters. 
- constellationoptional- The constellation that the star belongs to. 
- min_apparent_magnitudeoptional- Minimum apparent magnitude brightness of the star. 
- max_apparent_magnitudeoptional- Maximum apparent magnitude brightness of the star. 
- min_absolute_magnitudeoptional- Minimum absolute magnitude brightness of the star. 
- max_absolute_magnitudeoptional- Maximum absolute magnitude brightness of the star. 
- min_distance_light_yearoptional- Minimum distance the star is from Earth in light years. 
- max_distance_light_yearoptional- Maximum distance the star is from Earth in light years. 
- offsetoptional- Number of results to offset for pagination. 
Headers
- X-Api-Keyrequired- API Key associated with your account. 
Sample Request Live Demo!
https://api.api-ninjas.com/v1/stars?name=vegaHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
10
11
12
[
  {
    "name": "Vega",
    "constellation": "Lyra",
    "right_ascension": "18h 36m 56.19s",
    "declination": "+38° 46′ 58.8″",
    "apparent_magnitude": "0.03",
    "absolute_magnitude": "0.58",
    "distance_light_year": "25",
    "spectral_class": "A0Vvar"
  }
]Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/stars?name=vega" \
  -H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.