# NASA Astronomy Picture of the Day Scraper (`parseforge/apod-nasa-images-scraper`) Actor

Pull the daily NASA Astronomy Picture of the Day archive going back to 1995. Fetch a single date, a date range, or a random sample. Returns title, explanation, image and HD image URLs, video URLs, copyright, and per-day metadata.

- **URL**: https://apify.com/parseforge/apod-nasa-images-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Business, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $24.75 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

![ParseForge Banner](https://github.com/ParseForge/apify-assets/blob/ad35ccc13ddd068b9d6cba33f323962e39aed5b2/banner.jpg?raw=true)

## 🌌 NASA Astronomy Picture of the Day Scraper

> 🚀 **Export the entire APOD archive in seconds.** Pull NASA's Astronomy Picture of the Day catalog of **11,000+ pictures** going back to 1995, with HD image links, video thumbnails, official explanations, and credits. No API key, no login, no manual download wrangling.

> 🕒 **Last updated:** 2026-05-15 · **📊 13 fields** per record · **🌌 11,000+ pictures** · **📅 1995-present** · **🎥 Image + video coverage**

The **NASA Astronomy Picture of the Day Scraper** pulls from the official NASA APOD source and returns **13 fields per record**, including title, date, full explanation, standard and HD image URLs, video thumbnails, copyright credit, and a permalink to the original NASA page. APOD is one of the longest-running daily science publications on the internet and has been edited by professional astronomers Dr. Robert Nemiroff and Dr. Jerry Bonnell since 1995.

The archive covers **every day from 1995-06-16 to today**, one curated image or video per day, with concise expert-written context for each. This Actor exports a single date, a custom range, a random sample, or the latest entry as CSV, Excel, JSON, or XML. All filters run server-side, so you skip the date arithmetic and the HTML scraping entirely.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Educators, planetariums, science communicators, astronomy bloggers, app developers, researchers, content teams, hobbyist developers | Daily astronomy feeds, classroom slide decks, mobile background galleries, Slack/Discord daily-image bots, archival research, AI training datasets |

---

### 📋 What the NASA APOD Scraper does

Four selection workflows in a single run:

- 🌟 **Latest.** Today's picture, single record.
- 📅 **Single date.** Pull any specific day from 1995-06-16 onward.
- 📆 **Date range.** Bulk-export between any two dates (week, month, year, decade).
- 🎲 **Random sample.** Pull 1-100 random pictures across the entire archive.

Each record carries the full astronomer-written explanation, both the standard and HD image URLs (or the video URL plus thumbnail when the day's pick is a video), copyright credit, and a permalink to the original NASA page.

> 💡 **Why it matters:** APOD is the gold standard of daily science communication. Building your own pipeline means parsing dated HTML pages, handling video days, and chasing HD URLs. This Actor does it once, cleanly, in seconds.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded APOD dataset._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td><code>maxItems</code></td><td>integer</td><td><code>10</code></td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
<tr><td><code>mode</code></td><td>enum</td><td><code>"range"</code></td><td><code>latest</code>, <code>date</code>, <code>range</code>, or <code>random</code>.</td></tr>
<tr><td><code>date</code></td><td>string</td><td><code>""</code></td><td><code>YYYY-MM-DD</code> for <code>mode=date</code>. Earliest available is 1995-06-16.</td></tr>
<tr><td><code>startDate</code>, <code>endDate</code></td><td>string</td><td><code>""</code></td><td><code>YYYY-MM-DD</code> bounds for <code>mode=range</code>. Defaults to today if <code>endDate</code> is omitted.</td></tr>
<tr><td><code>randomCount</code></td><td>integer</td><td><code>10</code></td><td>1-100. Number of random pictures to return for <code>mode=random</code>.</td></tr>
<tr><td><code>thumbsForVideos</code></td><td>boolean</td><td><code>true</code></td><td>When the day's pick is a video, also return its thumbnail image URL.</td></tr>
</tbody>
</table>

**Example: every picture from January 2025.**

```json
{
    "mode": "range",
    "startDate": "2025-01-01",
    "endDate": "2025-01-31"
}
````

**Example: 25 random pictures from the full archive.**

```json
{
    "mode": "random",
    "randomCount": 25,
    "maxItems": 25
}
```

> ⚠️ **Good to Know:** about 5-10% of APOD entries are videos rather than images, in which case the standard `url` is a YouTube or Vimeo embed. Set `thumbsForVideos: true` to also receive a still thumbnail you can render in galleries.

***

### 📊 Output

Each picture record contains **13 fields**. Download the dataset as CSV, Excel, JSON, or XML.

#### 🧾 Schema

| Field | Type | Example |
|---|---|---|
| 🖼️ `imageUrl` | string | null | `"https://apod.nasa.gov/apod/image/2505/PillarsOfCreation_Webb_2160.jpg"` |
| 📅 `date` | string (YYYY-MM-DD) | `"2025-05-13"` |
| 📌 `title` | string | `"Pillars of Creation in Infrared"` |
| 📂 `mediaType` | string | `"image"` |
| 🔗 `permalink` | string | `"https://apod.nasa.gov/apod/ap250513.html"` |
| 👤 `copyright` | string | null | `"NASA, ESA, CSA, STScI"` |
| 📝 `explanation` | string | `"Sometimes the most spectacular sights in the cosmos..."` |
| 🔗 `url` | string | `"https://apod.nasa.gov/apod/image/2505/PillarsOfCreation_Webb_960.jpg"` |
| 🖼️ `hdUrl` | string | null | `"https://apod.nasa.gov/apod/image/2505/PillarsOfCreation_Webb_2160.jpg"` |
| 🖼️ `thumbnailUrl` | string | null | (for video days) |
| 🔢 `serviceVersion` | string | `"v1"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-15T00:00:00.000Z"` |
| ❌ `error` | string | undefined | (only when a record fails) |

#### 📦 Sample records

<details>
<summary><strong>🌌 Image entry: Pillars of Creation (JWST)</strong></summary>

```json
{
    "imageUrl": "https://apod.nasa.gov/apod/image/2505/PillarsOfCreation_Webb_2160.jpg",
    "date": "2025-05-13",
    "title": "Pillars of Creation in Infrared",
    "mediaType": "image",
    "permalink": "https://apod.nasa.gov/apod/ap250513.html",
    "copyright": "NASA, ESA, CSA, STScI",
    "explanation": "Sometimes the most spectacular sights in the cosmos are the things you cannot see in visible light. Imaged here by the James Webb Space Telescope in infrared, the famous Pillars of Creation in the Eagle Nebula reveal lanes of cooler dust and gas where new stars are still forming.",
    "url": "https://apod.nasa.gov/apod/image/2505/PillarsOfCreation_Webb_960.jpg",
    "hdUrl": "https://apod.nasa.gov/apod/image/2505/PillarsOfCreation_Webb_2160.jpg",
    "serviceVersion": "v1",
    "scrapedAt": "2026-05-15T00:00:00.000Z"
}
```

</details>

<details>
<summary><strong>🎥 Video entry: a time-lapse with thumbnail fallback</strong></summary>

```json
{
    "imageUrl": "https://img.youtube.com/vi/abcd1234/0.jpg",
    "date": "2025-04-22",
    "title": "Aurora Australis Time-Lapse from the ISS",
    "mediaType": "video",
    "permalink": "https://apod.nasa.gov/apod/ap250422.html",
    "copyright": "ISS Expedition 72",
    "explanation": "From the International Space Station, this time-lapse captures the green and crimson curtains of the southern aurora rippling across the polar atmosphere over five minutes of orbital flight.",
    "url": "https://www.youtube.com/embed/abcd1234?rel=0",
    "thumbnailUrl": "https://img.youtube.com/vi/abcd1234/0.jpg",
    "serviceVersion": "v1",
    "scrapedAt": "2026-05-15T00:00:00.000Z"
}
```

</details>

<details>
<summary><strong>📸 Random archive entry from 1996</strong></summary>

```json
{
    "imageUrl": "https://apod.nasa.gov/apod/image/9601/orion_aat_big.jpg",
    "date": "1996-01-23",
    "title": "M42: The Orion Nebula",
    "mediaType": "image",
    "permalink": "https://apod.nasa.gov/apod/ap960123.html",
    "explanation": "The Great Nebula in Orion, M42, is one of the most prominent stellar nurseries visible to the unaided eye. Lying at the southernmost star of Orion's sword, the nebula is a vast cloud of gas and dust about 1500 light-years distant.",
    "url": "https://apod.nasa.gov/apod/image/9601/orion_aat_big.jpg",
    "hdUrl": "https://apod.nasa.gov/apod/image/9601/orion_aat_big.jpg",
    "serviceVersion": "v1",
    "scrapedAt": "2026-05-15T00:00:00.000Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🌌 | **30 years of coverage.** Every entry from 1995-06-16 to today, one curated picture per day. |
| 🎥 | **Image + video handling.** Video days surface a thumbnail fallback so galleries never break. |
| 🔍 | **Four selection modes.** Latest, single date, range, or random sample, all in one input form. |
| 🖼️ | **HD links.** Both standard and HD URLs, plus a permalink back to the original NASA page. |
| 🚫 | **No API key required.** Works without registration or token management on your side. |
| ⚡ | **Fast.** 10 entries in under 5 seconds, a full month in under 20. |
| 📜 | **Open data.** Public-domain cosmic imagery, ready for archives, classrooms, and apps. |

> 📊 APOD is the most widely cited daily astronomy publication, with content used by educators, planetariums, content creators, and millions of curious readers since 1995.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| **⭐ NASA APOD Scraper** *(this Actor)* | $5 free credit, then pay-per-use | **11,000+ entries** | **Live per run** | latest, date, range, random | ⚡ 2 min |
| Manual NASA page scraping | Free | Per-page | One day at a time | None | 🐢 Hours per range |
| Static archive dumps | Free | Subset | Stale | None | 🕒 Variable |
| Paid stock-photo astronomy sets | $$ | Curated subset | One-shot | Topical | ⏳ Days |

Pick this Actor when you want clean, dated records ready for archives, daily bots, or training datasets.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the NASA Astronomy Picture of the Day Scraper page on the Apify Store.
3. 🎯 **Set input.** Pick a mode (latest, date, range, random), fill in any date bounds, and set `maxItems`.
4. 🚀 **Run it.** Click **Start** and let the Actor collect your data.
5. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 📱 Apps and daily-image products

- Daily astronomy lock-screen and wallpaper apps
- Slack/Discord daily-image bots for science teams
- Smart-display screensaver feeds
- Mobile gallery and quiz apps

</td>
<td width="50%" valign="top">

#### 🎓 Education and outreach

- Classroom slide decks with current cosmic events
- Planetarium pre-show feature pulls
- University astronomy 101 image library
- Public-library science programming

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 📰 Science publishing

- Editorial calendars with daily astronomy hooks
- Newsletter automation (weekly best-of round-ups)
- Social-media scheduling with credits and permalinks
- Long-form articles built on the dated archive

</td>
<td width="50%" valign="top">

#### 🛍️ Print, prints, and merchandise

- High-resolution print catalogs
- Educational poster collections
- Calendar products (one entry per day)
- Coffee-table book curation pipelines

</td>
</tr>
</table>

***

### 🔌 Automating NASA APOD Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. A daily run at 06:00 UTC is enough to keep a downstream gallery, newsletter, or notification feed in sync.

***

### 🌟 Beyond business use cases

Astronomy data powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Reproducible studies citing dated APOD entries
- Coursework on astronomical imaging and PR
- Long-term content analyses of science communication
- Image-classification training sets

</td>
<td width="50%">

#### 🎨 Personal and creative

- Custom desktop wallpapers, lock screens, screensavers
- Digital photo frames cycling through the archive
- Family-room daily-image rituals
- Hobbyist astrophotography reference libraries

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Science-museum daily content boards
- Public-library STEM programs
- After-school astronomy clubs
- Youth-coding workshop teaching datasets

</td>
<td width="50%">

#### 🧪 Experimentation

- Train computer-vision models on labeled cosmic imagery
- Prototype caption-generation models against expert text
- Build agent pipelines that summarize the daily image
- Validate visualization concepts with real archives

</td>
</tr>
</table>

***

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20NASA%20APOD%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20NASA%20APOD%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20NASA%20APOD%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20NASA%20APOD%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

Pick a mode (latest, single date, range, or random sample), fill in any dates, click Start, and the Actor pulls one clean structured record per picture. Video days surface a still thumbnail so galleries don't break.

#### 🗓️ How far back does the archive go?

The earliest entry is 1995-06-16. Every day since has a curated picture or video, with a few historic gaps that the upstream archive may carry as missing or repeat days.

#### 🎥 What happens on video days?

The Actor returns `mediaType: "video"`, the embed URL in `url`, and a still in `thumbnailUrl` (also mirrored to `imageUrl`) when `thumbsForVideos` is enabled. Roughly 5-10% of entries are videos.

#### 🔁 How often is the archive refreshed?

A new entry is published daily around 05:00 UTC. Any Actor run after that picks up the day's new record.

#### 🖼️ Are HD images always available?

Most entries include both a standard `url` and an `hdUrl`. A small minority of older entries lack HD versions, in which case `hdUrl` is null and `url` carries the best available resolution.

#### 👤 Are credits and copyrights returned?

Yes. The `copyright` field carries the credit line as published by APOD. Public-domain entries leave it null.

#### ⏰ Can I schedule daily runs?

Yes. Use Apify Schedules to run this Actor every day after 05:00 UTC and keep your downstream feed in sync automatically.

#### ⚖️ Is this data legal to use?

NASA APOD content is open and widely reused, with credit lines on each picture. Always preserve the credit and link back to the original page. Some entries may have specific copyright terms in the credit line, so review per-image when redistributing.

#### 💼 Can I use these images commercially?

Public-domain entries can be used commercially. Entries with named copyright holders may require permission for commercial use. The `copyright` field tells you which is which.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit and gives you access to scheduling, higher concurrency, and larger datasets.

#### 🔁 What happens if a run fails or gets interrupted?

Apify automatically retries transient errors. If a run still fails, you can inspect the log in the Runs tab, fix the input, and re-run. Partial datasets from failed runs are preserved so you never lose progress.

#### 🆘 What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.

***

### 🔌 Integrate with any app

NASA APOD Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Post the daily image into a channel
- [**n8n**](https://docs.apify.com/platform/integrations/n8n) - Drop runs into self-hosted workflows
- [**Pipedream**](https://docs.apify.com/platform/integrations/pipedream) - Trigger event-driven pipelines
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe APOD records into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push the daily picture into your CMS, or send a Slack message with the title and explanation as soon as the new entry drops.

***

### 🔗 Recommended Actors

- [**🛰️ CelesTrak Satellites Orbital Catalog Scraper**](https://apify.com/parseforge/celestrak-tle-satellites-scraper) - 47 satellite groups with full orbital elements
- [**🚀 Launch Library 2 Rocket Launches Scraper**](https://apify.com/parseforge/ll-spacedevs-launch-scraper) - Upcoming and historical orbital launches
- [**🌍 EONET Natural Events Scraper**](https://apify.com/parseforge/eonet-natural-events-scraper) - NASA's open natural-event tracker
- [**🎨 Met Museum Scraper**](https://apify.com/parseforge/met-museum-scraper) - 470,000+ open-access artworks
- [**🖼️ Openverse Audio Scraper**](https://apify.com/parseforge/openverse-audio-scraper) - Open-licensed audio works

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more reference-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by NASA, the APOD editors, or any of its content contributors. All trademarks mentioned are the property of their respective owners. Only publicly available open astronomy content is collected and credit lines are preserved on every record.

# Actor input Schema

## `mode` (type: `string`):

How to select pictures: latest (single most recent), single date, date range, or random sample. Default 'latest' returns just today's picture; switch to 'range' or 'random' for bulk pulls.

## `date` (type: `string`):

YYYY-MM-DD. Used when Fetch Mode = 'Single date'. Earliest available is 1995-06-16.

## `startDate` (type: `string`):

YYYY-MM-DD. Used when Fetch Mode = 'Date range'. If both start and end are omitted in range mode, the scraper defaults to the most recent 10 days.

## `endDate` (type: `string`):

YYYY-MM-DD. Used when Fetch Mode = 'Date range'. Defaults to today if omitted.

## `randomCount` (type: `integer`):

Number of random pictures to return when Fetch Mode = 'Random sample'. 1-100 (upstream cap). For larger random batches, use multiple runs.

## `thumbsForVideos` (type: `boolean`):

When the picture of the day is a video, also return its thumbnail image URL alongside the playable video URL.

## `maxItems` (type: `integer`):

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## Actor input object example

```json
{
  "mode": "latest",
  "randomCount": 10,
  "thumbsForVideos": true,
  "maxItems": 10
}
```

# Actor output Schema

## `overview` (type: `string`):

Overview of scraped data

## `fullData` (type: `string`):

Complete dataset

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/apod-nasa-images-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "maxItems": 10 }

# Run the Actor and wait for it to finish
run = client.actor("parseforge/apod-nasa-images-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "maxItems": 10
}' |
apify call parseforge/apod-nasa-images-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/apod-nasa-images-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "NASA Astronomy Picture of the Day Scraper",
        "description": "Pull the daily NASA Astronomy Picture of the Day archive going back to 1995. Fetch a single date, a date range, or a random sample. Returns title, explanation, image and HD image URLs, video URLs, copyright, and per-day metadata.",
        "version": "0.0",
        "x-build-id": "ABjDMhCNx56XAMJca"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~apod-nasa-images-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-apod-nasa-images-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~apod-nasa-images-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-apod-nasa-images-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~apod-nasa-images-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-apod-nasa-images-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Fetch Mode",
                        "enum": [
                            "latest",
                            "date",
                            "range",
                            "random"
                        ],
                        "type": "string",
                        "description": "How to select pictures: latest (single most recent), single date, date range, or random sample. Default 'latest' returns just today's picture; switch to 'range' or 'random' for bulk pulls.",
                        "default": "latest"
                    },
                    "date": {
                        "title": "Single Date",
                        "type": "string",
                        "description": "YYYY-MM-DD. Used when Fetch Mode = 'Single date'. Earliest available is 1995-06-16."
                    },
                    "startDate": {
                        "title": "Range Start Date",
                        "type": "string",
                        "description": "YYYY-MM-DD. Used when Fetch Mode = 'Date range'. If both start and end are omitted in range mode, the scraper defaults to the most recent 10 days."
                    },
                    "endDate": {
                        "title": "Range End Date",
                        "type": "string",
                        "description": "YYYY-MM-DD. Used when Fetch Mode = 'Date range'. Defaults to today if omitted."
                    },
                    "randomCount": {
                        "title": "Random Sample Size",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Number of random pictures to return when Fetch Mode = 'Random sample'. 1-100 (upstream cap). For larger random batches, use multiple runs.",
                        "default": 10
                    },
                    "thumbsForVideos": {
                        "title": "Thumbnails for Videos",
                        "type": "boolean",
                        "description": "When the picture of the day is a video, also return its thumbnail image URL alongside the playable video URL.",
                        "default": true
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
