NASA APOD API
Free NASA Astronomy Picture of the Day API. Daily space images with expert explanations, HD URLs and archive access back to 1995. Tested curl example.
Endpoint tested and returned HTTP 200 on 19 Aug 2026
What is the NASA APOD API?
The NASA APOD API returns the Astronomy Picture of the Day — a daily space image or video with a professional astronomer's explanation. It is free, works with the shared DEMO_KEY for testing, and archives back to June 1995.
APOD is one of the longest-running features on the internet, publishing a curated astronomy image with an expert explanation every day since 1995. The API exposes that entire archive, which is over 10,000 images with genuinely well-written accompanying text.
You can test with `api_key=DEMO_KEY`, as the verified example here does, but that key is shared across every anonymous user worldwide and is limited to about 30 requests per hour per IP. Registering for your own free key takes under a minute and raises the limit to 1,000 requests per hour.
Quick facts
- Base URL
https://api.nasa.gov/planetary/apod- Authentication
- Free API key required. DEMO_KEY works for casual testing but is heavily rate-limited; register at api.nasa.gov for your own.
- Rate limit
- DEMO_KEY: about 30 requests/hour per IP. Personal key: 1,000 requests/hour.
- Pricing
- Free. NASA imagery is generally public domain, but check each image's credit line.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the NASA APOD API
Every request below was executed against the live API on 19 Aug 2026, and the response shown is the real body it returned — not an illustration.
1. Fetch today's astronomy picture
GET https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY
curl 'https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY'const res = await fetch("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY", timeout=20)
res.raise_for_status()
print(res.json()){
"date": "2026-08-19",
"explanation": "Whatdunit? What disappeared while crossing a partially eclipsed Sun? Let’s present the evidence. The 24 frames-per-second video was taken in Spain (40°34'30.3\"N 1°12'28.8\"W) at 20:28 local time on August 12, 2026. The Perseids meteor shower was at its peak during this time. Is this a meteor? Meteor showers trace back to a region of the sky called a radiant point that corresponds to where the Earth is crossing a comet’s path. The object’s path might trace back to the Perseids’ radiant point in the Perseus constellation. The object trails a smaller angle on the sky than the 0.5 degree Sun and Moon, which is smaller than expected for a meteor. Its brightness does not extend much past the Sun, but a meteor burning up in the sky would not need sunlight to be seen. Perhaps the sunlight is reflecting off of the object? After cross-referencing the location, time, and point in the sky with a flight database, the culprit is found to be an airplane contrail!",
"media_type": "video",
"service_version": "v1",
"title": "The Case of the Mysterious Maybe Meteor",
"url": "https://apod.nasa.gov/apod/image/2608/perseids_eclipse_mystery.mp4"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | Required | Your NASA key, or DEMO_KEY for testing. DEMO_KEY |
date | string | Optional | Specific date as YYYY-MM-DD, from 1995-06-16 onwards. 2026-01-01 |
start_date / end_date | string | Optional | Date range to fetch many entries at once. 2026-01-01 |
count | integer | Optional | Return this many random images instead of a date. 5 |
thumbs | boolean | Optional | Include a thumbnail URL when the entry is a video. true |
Response fields
titlestring- Title of the image.
explanationstring- Detailed explanation written by a professional astronomer — several hundred words.
urlstring- Standard resolution image or video URL.
hdurlstring- High resolution image URL. Absent for video entries.
media_typestring- `image` or `video` — always branch on this before rendering.
copyrightstring- Present only when the image is not public domain.
What you can build with the NASA APOD API
- Build a daily space image widget or wallpaper app
- Create an educational astronomy resource with expert-written text
- Generate a random space image gallery using the count parameter
- Practise handling mixed media types in a single feed
Common errors and how to fix them
429 OVER_RATE_LIMIT
DEMO_KEY's shared hourly allowance is exhausted.
Fix: Register a free key at api.nasa.gov — it takes a minute and gives 1,000 requests/hour.
400
Date outside the valid range.
Fix: The archive starts at 1995-06-16; earlier dates are rejected.
hdurl missing
The entry is a video, not an image.
Fix: Check `media_type` before reading image-specific fields.
NASA APOD API — frequently asked questions
Is the NASA API free?
Yes. It requires a free API key, and DEMO_KEY works for casual testing. Registering your own key at api.nasa.gov raises the limit from roughly 30 to 1,000 requests per hour.
How far back does the APOD archive go?
To 16 June 1995, giving more than 10,000 entries, each with a professionally written explanation.
Why is hdurl sometimes missing?
Some entries are videos rather than images. Always check `media_type` first and render accordingly — this is the most common bug when integrating APOD.
Can I use NASA images commercially?
NASA imagery is generally public domain, but APOD sometimes features images from other photographers. If a `copyright` field is present, that image is not public domain — check before commercial use.
Tools that pair with this API
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
Image Cropper
Crop images online to an exact rectangle with pixel-precise x, y, width and height inputs or aspect-ratio presets. Free, private and browser-based.
Alternatives to NASA APOD API
If NASA APOD does not fit, these science & space apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.
| API | What it does | Auth | CORS | Last verified |
|---|---|---|---|---|
| Open Notify ISS | Free API returning the International Space Station's live latitude and longitude. No key, updates in real time. Tested curl example and live JSON response. | No key | Yes | 19 Aug 2026 |
| USGS Earthquake | Free USGS earthquake API with no key: live global seismic events as GeoJSON, filterable by magnitude, time and location. Tested curl example and live response. | No key | Yes | 19 Aug 2026 |
| Launch Library 2 | Free rocket launch API with no key: upcoming and past launches from every space agency, with rockets, missions, pads and live stream links. Tested example. | No key | Yes | 19 Aug 2026 |
| Wikipedia REST API | Free Wikipedia REST API with no key: article summaries, extracts, thumbnails and full content in 300+ languages. CORS enabled. Tested curl example. | No key | Yes | 19 Aug 2026 |
| NASA NeoWs (Asteroids) | Free NASA asteroid API: near-Earth objects by date with size, velocity, miss distance and hazard classification. Works with DEMO_KEY. Tested example. | Key | Yes | 20 Aug 2026 |
| NASA EPIC | Free NASA EPIC API: full-disc Earth photographs taken daily from the DSCOVR satellite a million miles away, with coordinates and metadata. Tested example. | Key | Yes | 20 Aug 2026 |
NASA APOD is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 19 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.