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:
nameoptionalThe name of the planet.
min_massoptionalMinimum mass of the planet in Jupiters (1 Jupiter = 1.898 × 1027 kg).
max_massoptionalMaximum mass of the planet in Jupiters (1 Jupiter = 1.898 × 1027 kg).
min_radiusoptionalMinimum average radius of the planet in Jupiters (1 Jupiter = 69911 km).
max_radiusoptionalMaximum average radius of the planet in Jupiters (1 Jupiter = 69911 km).
min_periodoptionalMinimum orbital period of the planet in Earth days.
max_periodoptionalMaximum orbital period of the planet in Earth days.
min_temperatureoptionalMinimum average surface temperature of the planet in Kelvin.
max_temperatureoptionalMaximum average surface temperature of the planet in Kelvin.
min_distance_light_yearoptionalMinimum distance the planet is from Earth in light years.
max_distance_light_yearoptionalMaximum distance the planet is from Earth in light years.
min_semi_major_axisoptionalMinimum semi major axis of planet in astronomical units (AU).
max_semi_major_axisoptionalMaximum semi major axis of planet in astronomical units (AU).
offsetoptionalNumber of results to offset for pagination.
Headers
X-Api-KeyrequiredAPI 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.