NASA APIimages.nasa.gov ↗
Search and retrieve NASA media: images, videos, audio, HD assets, captions, metadata, and trending items via a structured JSON API.
What is the NASA API?
This API exposes 10 endpoints covering the NASA Image and Video Library at images.nasa.gov, giving you access to search results, trending and newest uploads, full-resolution assets, EXIF/XMP metadata, and video captions. The get_item_details endpoint returns a single structured object combining the item's descriptive data, all asset URLs at every available resolution, and embedded technical metadata fields — making it the primary endpoint for building media-detail views.
curl -X GET 'https://api.parse.bot/scraper/d4074a66-699d-4314-ad64-6f0c3c2f25e2/search?q=Apollo&page=1&query=Mars¢er=JPL&keywords=Moon&year_end=2025&page_size=5&media_type=image&year_start=2020' \ -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 images-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 Image and Video Library SDK — bounded, re-runnable."""
from parse_apis.nasa_image_and_video_library_api import NASAMedia, MediaType, ItemNotFound
nasa = NASAMedia()
# Search for Mars images using the MediaType enum, capped at 3 results
for item in nasa.mediaitems.search(query="Mars", media_type=MediaType.IMAGE, limit=3):
print(item.nasa_id, item.title, item.media_type)
# Browse popular items
for item in nasa.mediaitems.list_popular(limit=3):
print(item.nasa_id, item.title, item.date_created)
# Drill-down: take ONE item, refresh for full details, walk assets
item = nasa.mediaitems.search(query="Apollo 11", limit=1).first()
if item:
detail = item.refresh()
print(detail.nasa_id, detail.hd_url)
for asset in item.assets.list(limit=5):
print(asset.href)
# Browse trending images with HD URLs
for img in nasa.trendingimages.list_top3(limit=3):
print(img.nasa_id, img.title, img.hd_url)
# Get captions for a video via sub-resource navigation
video = nasa.mediaitem("172_ISS-Slosh")
caption = video.caption.get()
print(caption.location)
# Typed error handling: catch ItemNotFound for a bad NASA ID
try:
detail = nasa.mediaitems.get(nasa_id="NONEXISTENT_ID_XYZ")
print(detail.nasa_id)
except ItemNotFound as exc:
print(f"Item not found: {exc.nasa_id}")
print("exercised: search / list_popular / refresh / assets.list / list_top3 / caption.get / get")
Search the NASA media library by keyword with optional filtering by media type, year range, keywords, and center. Returns paginated results with metadata and preview links. Pagination uses a page counter; each item carries data (title, nasa_id, media_type, date_created, description, keywords) and links (preview thumbnails). Server-side filtering covers query text, media type, year range, keywords, and center. Total hits are in metadata.total_hits.
| Param | Type | Description |
|---|---|---|
| page | integer | Page number for pagination (1-based). |
| query | string | Search query text (e.g. 'Mars', 'Apollo 11'). If omitted, returns all items matching other filters. |
| center | string | NASA center that published the item (e.g. 'JPL', 'GSFC', 'JSC'). |
| keywords | string | Comma-separated keywords to filter results. |
| year_end | string | Filter results to items created on or before this year (4-digit year, e.g. '2025'). |
| page_size | string | Number of results per page (max 100). |
| media_type | string | Comma-separated media types to include. Accepted values: image, video, audio. |
| year_start | string | Filter results to items created on or after this year (4-digit year, e.g. '2020'). |
{
"type": "object",
"fields": {
"items": "array of media items with nasa_id, title, center, media_type, date_created, description, keywords, and links",
"links": "array of pagination links (next/prev)",
"metadata": "object with total_hits count"
},
"sample": {
"data": {
"items": [
{
"links": [
{
"rel": "preview",
"href": "https://images-assets.nasa.gov/image/PIA24567/PIA24567~thumb.jpg",
"render": "image"
}
],
"title": "NASA Integrates Gear Motors for Robotic Arm on Future Lunar Missions",
"center": "JPL",
"nasa_id": "PIA24567",
"keywords": [
"Moon"
],
"media_type": "image",
"description": "In early 2022, the Cold Operable Lunar Deployable Arm project...",
"date_created": "2022-02-01T00:00:00Z"
}
],
"links": [],
"metadata": {
"total_hits": 4
}
},
"status": "success"
}
}About the NASA API
Search and Discovery
The search endpoint accepts a free-text query string alongside optional filters: media_type (image, video, or audio, comma-separated), center (NASA publishing center such as JPL or GSFC), keywords, year_start, and year_end. Results are paginated — use page and page_size (up to 100 per page) to walk through the collection object returned, which includes a total_hits count and navigation links. If you omit query, the endpoint returns all items matching the remaining filters. The get_trending_and_popular and get_newest_uploads endpoints take no parameters and return ordered collections with nasa_id, title, media_type, and date_created for each item.
Asset Resolution and HD Retrieval
Every media item is identified by a nasa_id string (e.g. PIA12235). The get_asset endpoint returns the full manifest of file URLs for that ID, which may include original (~orig), medium, small, and thumbnail variants, plus a metadata.json link. The get_hd_image_url endpoint distills that manifest to a single hd_url string pointing to the highest available resolution — falling back from ~orig to ~large to ~medium when a lower tier is the best available. The get_top3_trending_images endpoint combines trending discovery with asset resolution, returning nasa_id, title, thumbnail, and hd_url for the top three results in one call.
Detailed Item Metadata
The get_item_details endpoint is the richest response shape available. For a given nasa_id it returns a data object with title, description, keywords, center, date_created, and media_type; a links array of preview URLs; a full assets array; the resolved hd_url; and a metadata object containing EXIF, XMP, and AVAIL fields extracted from the image file itself. This makes it suitable for applications that need both editorial context and technical imaging data in a single request.
Captions and Convenience Endpoints
For video assets, the get_captions endpoint accepts a nasa_id and returns a location string pointing to the .srt subtitle file for that video. The get_trending_images_only and get_all_trending_image_urls endpoints filter the trending collection to images exclusively, returning arrays of nasa_id, title, and thumbnail URLs — useful for feed widgets or gallery prefetching without needing to filter media_type client-side.
The NASA API is a managed, monitored endpoint for images.nasa.gov — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when images.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 images.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 NASA media gallery that surfaces trending images with HD download links using
get_top3_trending_images. - Populate an educational content platform with the latest NASA uploads by polling
get_newest_uploadson a schedule. - Index NASA video content with synchronized subtitles by pairing
search(media_type=video) withget_captionsper result. - Display full technical provenance for a spacecraft image — EXIF, XMP, and editorial description — using
get_item_details. - Filter historical Apollo-era imagery by querying
searchwithyear_start=1961,year_end=1972, andkeywords=Apollo. - Generate a center-specific media feed by passing
center=JPLorcenter=JSCto thesearchendpoint. - Resolve the highest-quality download URL for any NASA asset by calling
get_hd_image_urlwith itsnasa_id.
| 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 provide an official developer API for images.nasa.gov?+
What does `get_item_details` return that `get_asset` does not?+
get_asset returns only the array of file-resolution URLs for a given nasa_id. get_item_details combines those asset URLs with the item's editorial data (title, description, keywords, center, date_created, media_type), a links array, the resolved hd_url, and a metadata object containing EXIF, XMP, and AVAIL fields — so it aggregates what would otherwise require two or three separate calls.Does the `search` endpoint support full-text search across item descriptions and keywords?+
query parameter matches against the NASA library's title, description, and keyword fields. You can also pass a separate keywords filter alongside query to narrow by explicit tags. There is no dedicated field-scoped search (e.g. title-only or description-only queries) — both inputs apply broadly. Pagination is controlled by page and page_size (max 100 per page); total_hits in the response tells you the full result count.Can I retrieve user-uploaded or community-contributed media through this API?+
center field (e.g. JPL, GSFC, JSC) identifying the publishing organization. Community or third-party uploads are not part of the NASA Image and Video Library and are not accessible here. You can fork this API on Parse and revise it to add endpoints pulling from other public NASA data sources if needed.Are audio assets accessible the same way as images and videos?+
search results when media_type includes audio, and their asset URLs are returned by get_asset and get_item_details like any other media type. However, the convenience endpoints (get_trending_images_only, get_all_trending_image_urls, get_top3_trending_images, get_hd_image_url) are scoped to images only and will not surface audio items. You can fork this API on Parse and revise it to add audio-specific convenience endpoints.