Planets API
The Planets API provides key statistics for thousands of planets and exoplanets discovered in the known universe.
From 6,924 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 281ms | 305ms | 338ms | 534ms | 969ms |
Didn't find what you were looking for? Suggest an improvement
/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.
Response
A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.
nameThe name of the planet.
massMass of the planet in Jupiters (1 Jupiter = 1.898 × 1027 kg).
radiusAverage radius of the planet in Jupiters (1 Jupiter = 69911 km).
periodOrbital period of the planet in Earth days.
semi_major_axisSemi-major axis of the planet's orbit in astronomical units (AU).
temperatureAverage surface temperature of the planet in Kelvin.
distance_light_yearDistance from Earth in light years.
host_star_massMass of the host star in solar masses.
host_star_temperatureTemperature of the host star in Kelvin.
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
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.
Frequently Asked Questions
Can I use the Planets API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Planets API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Planets API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Planets API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What data does the Planets API provide?
The Planets API returns key statistics for thousands of planets and exoplanets discovered in the known universe, including each planet'smassandradius(in Jupiters), orbitalperiodin Earth days,semi_major_axisin AU, average surfacetemperaturein Kelvin, anddistance_light_yearfrom Earth. It also reports details about the planet's star via thehost_star_mass(in solar masses) andhost_star_temperature(in Kelvin) fields.How do I look up a specific planet or filter by its properties?
Pass thenameparameter to look up a planet directly (for examplename=Neptune), or filter by physical characteristics using range parameters such asmin_mass/max_mass,min_radius/max_radius,min_period/max_period,min_temperature/max_temperature, andmin_distance_light_year/max_distance_light_year. At least one of these parameters (other thanoffset) must be set; see the API documentation for the full list.How many planets are returned per request, and how do I get more?
Each request returns at most 30 results, so to page through larger result sets you set theoffsetparameter across multiple calls (for exampleoffset=30for the next page). Higher request volumes are supported on paid plans listed on the pricing page.What are some use cases for the Planets API?
The Planets API is useful for astronomy education apps, exoplanet data dashboards, and trivia or quiz games that filter planets bymass,radius, ordistance_light_year. It pairs well with the Stars API for host-star data and the Facts API for surfacing fun astronomy facts.