Planets API
The Planets API provides key statistics for thousands of planets and exoplanets discovered in the known universe.
/v1/planets GET
https://api.api-ninjas.com/v1/planets
Get a list of planets 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) must be set:
- nameoptional- The name of the planet. 
- min_massoptional- Minimum mass of the planet in Jupiters (1 Jupiter = 1.898 × 1027 kg). 
- max_massoptional- Maximum mass of the planet in Jupiters (1 Jupiter = 1.898 × 1027 kg). 
- min_radiusoptional- Minimum average radius of the planet in Jupiters (1 Jupiter = 69911 km). 
- max_radiusoptional- Maximum average radius of the planet in Jupiters (1 Jupiter = 69911 km). 
- min_periodoptional- Minimum orbital period of the planet in Earth days. 
- max_periodoptional- Maximum orbital period of the planet in Earth days. 
- min_temperatureoptional- Minimum average surface temperature of the planet in Kelvin. 
- max_temperatureoptional- Maximum average surface temperature of the planet in Kelvin. 
- min_distance_light_yearoptional- Minimum distance the planet is from Earth in light years. 
- max_distance_light_yearoptional- Maximum distance the planet is from Earth in light years. 
- min_semi_major_axisoptional- Minimum semi major axis of planet in astronomical units (AU). 
- max_semi_major_axisoptional- Maximum semi major axis of planet in astronomical units (AU). 
- 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/planets?name=NeptuneHeaders
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
13
[
  {
    "name": "Neptune",
    "mass": 0.0537,
    "radius": 0.346,
    "period": 59800,
    "semi_major_axis": 30.07,
    "temperature": 72,
    "distance_light_year": 0.000478,
    "host_star_mass": 1,
    "host_star_temperature": 6000
  }
]Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/planets?name=Neptune" \
  -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.