Science and space

NASA APIs

by api.nasa.gov

Science and space Added on October 31st, 2026 Checked and working on November 1st, 2026
Visit api.nasa.gov →

What it does

api.nasa.gov is the portal to a collection of NASA APIs: the Astronomy Picture of the Day, photos from the Mars rovers, near-Earth asteroids, space weather events, Earth imagery from the EPIC camera, and more. Responses are JSON. Free; the shared DEMO_KEY works for trying things out, and a free personal key gives much higher limits.
  • API
  • HTTP-GET
  • JSON
  • REST

At a glance

API key
Needed, free · More APIs with a free key
Pricing
Free; the shared DEMO_KEY works for trying things out, and a free personal key gives much higher limits.
From the browser
Yes (CORS)
Formats
JSON
Interface
REST, HTTP-GET
Provider
api.nasa.gov
Last checked
Working on November 1st, 2026

More information: https://api.nasa.gov/

Is this your service? Show that it is listed

Put this badge on your website or in your README; it links to this page. About the badge

Listed on Free Web Services

api.nasa.gov
NASA APIs

Example request

curl

curl 'https://api.nasa.gov/planetary/apod?api_key=YOUR_API_KEY'

JavaScript

const response = await fetch("https://api.nasa.gov/planetary/apod?api_key=YOUR_API_KEY");
const data = await response.json();
console.log(data);

Python

import requests

response = requests.get(
    "https://api.nasa.gov/planetary/apod?api_key=YOUR_API_KEY",
    timeout=30,
)
print(response.json())

Replace YOUR_API_KEY with your own key. The JavaScript works in a web page as well as in Node.js 18 or newer.

Did it work for you?

Tell us what you found when you tried NASA APIs.