NASA APImars.nasa.gov ↗
Access NASA Mars rover images, weather data, location tracking, rock samples, mission details, news, and planetary facts via 12 structured endpoints.
What is the NASA API?
This API covers NASA's Mars Exploration Program across 12 endpoints, returning rover imagery, environmental data, GeoJSON traverse paths, rock sample collections, and editorial content. The get_perseverance_raw_images endpoint alone exposes per-image metadata including sol, camera name, UTC date, and image files, with filtering by camera instrument and pagination by sol. Coverage spans both Perseverance and Curiosity missions plus static Mars planetary facts.
No input parameters required.
curl -X GET 'https://api.parse.bot/scraper/29bc9970-6740-474d-aad0-d77e3d8e4483/get_mars_overview' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace mars-nasa-gov-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: NASA Mars Exploration SDK — bounded, re-runnable; every call capped."""
from parse_apis.nasa_mars_exploration_api import NasaMars, Rover, MissionSlug, MissionNotFound
nasa = NasaMars()
# Get mission detail for Perseverance
mission = nasa.missions.get(slug=MissionSlug.MARS_2020_PERSEVERANCE)
print(mission.slug, mission.type)
# List Perseverance raw images, capped
for image in nasa.perseveranceimages.list(sol=100, num=5, limit=3):
print(image.imageid, image.sol, image.date_taken_utc)
# List Curiosity images filtered by sol
for image in nasa.curiosityimages.list(sol=1000, per_page=5, limit=3):
print(image.id, image.instrument, image.title)
# Get Mars weather for Perseverance
for sol in nasa.weathersols.list(rover=Rover.PERSEVERANCE, limit=5):
print(sol.terrestrial_date, sol.season, sol.min_temp, sol.max_temp)
# Search news articles
for article in nasa.newsarticles.search(query="perseverance", limit=3):
print(article.title, article.publish_date, article.post_type)
# Get rover location data
location = nasa.roverlocations.get_perseverance()
print(location.traverse)
# Typed error handling: catch a bad mission slug
try:
nasa.missions.get(slug="nonexistent-mission-xyz")
except MissionNotFound as exc:
print(f"Mission not found: {exc.slug}")
print("exercised: missions.get / perseveranceimages.list / curiosityimages.list / weathersols.list / newsarticles.search / roverlocations.get_perseverance")
Retrieve the NASA global navigation structure. Returns an array of top-level categories (Missions, Humans in Space, Earth & Climate, etc.) each with their menu items and links. Useful for discovering the overall content organization.
No input parameters required.
{
"type": "object",
"fields": {
"type": "string identifier for the nav type (e.g. 'global-nav')",
"value": "array of navigation category objects each containing id, title, slug, location, and menu_items"
},
"sample": {
"data": {
"type": "global-nav",
"value": [
{
"id": 3850,
"slug": "missions",
"title": "Missions",
"location": "global-nav-missions",
"menu_items": [
{
"id": 131284,
"url": "https://www.nasa.gov/missions/",
"order": 1,
"title": "Search All NASA Missions"
}
]
}
]
},
"status": "success"
}
}About the NASA API
Rover Imagery
get_perseverance_raw_images and get_curiosity_raw_images return arrays of image objects filterable by Martian sol, camera instrument name, and page number. Perseverance camera codes include NAVCAM_LEFT and FRONT_HAZCAM_LEFT_A; Curiosity supports instruments like NAV_LEFT_B and CHEMCAM_RMI. Each image record carries sol, date_taken_utc, camera, image_files, and caption. The total_results (Perseverance) or total (Curiosity) field lets you calculate pages before fetching.
Location and Samples
get_perseverance_location and get_curiosity_location return GeoJSON FeatureCollection objects. Perseverance data includes a traverse path with per-segment sol and distance, plus a current_location point with elevation and cumulative distance traveled. Curiosity returns the same traverse structure alongside a waypoints collection that adds drive_type per stop. get_perseverance_rock_samples returns every collected sample as a GeoJSON Feature with sample_name, sample_type, rock_type, sol, date, and coordinates — useful for mapping sample sites against the traverse path.
Weather and Environmental Data
get_mars_weather accepts a rover parameter (perseverance or curiosity) and returns an array of sol objects each containing terrestrial_date, sol, ls (solar longitude), season, min_temp, max_temp, pressure, sunrise, and sunset. This makes it straightforward to correlate image capture dates with surface conditions.
News, Multimedia, and Facts
get_mars_news and get_mars_multimedia both support page, limit, and query parameters and return paginated content arrays with pagination_meta. get_mars_facts returns a sections array organized by topic — Introduction, Atmosphere, Surface, Moons, and more — each with content paragraphs, plus a total_sections count. Mission context comes from list_mars_missions (active rover codes like M20 and MSL plus mission link objects) and get_mission_detail, which takes a slug such as mars-2020-perseverance and returns navigation links and post details.
The NASA API is a managed, monitored endpoint for mars.nasa.gov — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when mars.nasa.gov changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official mars.nasa.gov API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a sol-by-sol Perseverance image browser filtered by specific camera instruments like NAVCAM_LEFT
- Plot the Curiosity rover's full traverse path and waypoints on an interactive map using the GeoJSON FeatureCollection
- Overlay Perseverance rock sample collection sites on the rover's traverse path for geological analysis
- Correlate rover image capture dates with surface weather data (temperature, pressure, season) from get_mars_weather
- Display a live Mars news feed with search filtering using get_mars_news pagination and query parameters
- Generate a Mars facts reference page organized by topic sections returned from get_mars_facts
- Track active mission codes and navigation structure for both Perseverance and Curiosity using list_mars_missions
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does NASA's Mars site have an official developer API?+
How do I filter rover images by camera and sol?+
get_perseverance_raw_images and get_curiosity_raw_images accept sol (Martian sol number) and camera (instrument name string) as optional parameters. Perseverance uses codes like NAVCAM_LEFT or FRONT_HAZCAM_LEFT_A; Curiosity uses names like NAV_LEFT_B or CHEMCAM_RMI. You can paginate results using the page parameter alongside the total_results or total field to determine how many pages exist.Does the weather endpoint return forecast data, or only historical sol records?+
get_mars_weather endpoint returns recorded per-sol data — each object includes terrestrial_date, sol, min_temp, max_temp, pressure, sunrise, and sunset for completed sols. It does not return predictive forecast data. The rover parameter lets you switch between Perseverance and Curiosity records.Does the API expose Ingenuity helicopter flight data or images?+
Are historic rover missions like Opportunity or Spirit covered?+
list_mars_missions endpoint returns mission links that may reference past missions in navigation context, but there are no dedicated image, weather, or location endpoints for Opportunity, Spirit, or other completed missions. You can fork the API on Parse and revise it to add endpoints covering those missions.