# NASA Space Data: APOD, Asteroids & Space Weather (`cynix_dev/nasa-space-data`) Actor

Fetch NASA open data: Astronomy Picture of the Day, near-Earth asteroid tracking (NEO), and space weather alerts (DONKI). Keyless with optional API key for higher rate limits.

- **URL**: https://apify.com/cynix\_dev/nasa-space-data.md
- **Developed by:** [Cynix Dev](https://apify.com/cynix_dev) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 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.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## NASA Space Data: APOD, Asteroids & Space Weather

Fetch current **NASA open data** from three built-in sources with no API key required
(an optional personal key raises the rate limit from 30/hr to 1,000/hr).

![NASA](https://img.logo.dev/nasa.gov?token=pk_f3e1270e3c2e4cb5a0c3a8d86e96b90a\&size=200\&retina=true\&format=png)

### Data Sources

#### 🌌 Astronomy Picture of the Day (APOD)

Daily astronomy imagery with the expert caption. Get the latest image(s) or a
specific date. NASA's most popular public feed — used by educators, media, and
space enthusiasts worldwide.

#### ☄️ Near-Earth Asteroids (NEO)

Real-time tracking of asteroids approaching Earth. Returns each object's name,
estimated diameter, approach date, velocity, miss distance, and potential-hazard
flag. Choose a single date or a date range up to 7 days.

#### 🌩️ Space Weather (DONKI)

Solar activity alerts from NASA's Space Weather Database of Notifications:

- **Solar Flares (FLR)** — class (A/B/C/M/X), location, instruments
- **Coronal Mass Ejections (CME)** — speed, half-angle, linked analyses
- **Geomagnetic Storms (GST)** — K-index severity
- **Solar Energetic Particles (SEP)** — particle event class
- **All notifications** — recent advisory bulletins

### Example Inputs

#### Fetch today's astro photo, today's asteroids, and recent space weather

```json
{
  "source": ["apod", "neo", "donki"],
  "apodCount": 1,
  "neoMode": "feed",
  "maxAsteroids": 50,
  "donkiType": "all"
}
```

#### 5 most recent APOD images + today's near-Earth objects

```json
{
  "source": ["apod", "neo"],
  "apodCount": 5,
  "neoStartDate": "2024-03-01",
  "neoEndDate": "2024-03-01",
  "maxAsteroids": 100
}
```

#### Solar flare and geomagnetic storm watch (last 30 days)

```json
{
  "source": ["donki"],
  "donkiType": "flr"
}
```

### Output

Each record is tagged with its `source` (APOD / NEO / DONKI) plus:

| Field | Description |
|-------|-------------|
| `source` | APOD / NEO / DONKI |
| `date` | Event or observation date |
| `title` | Image title or event name |
| `description` | NASA caption or explanation |
| `url` | Image/resource URL |
| `type` | image / asteroid / solar\_flare / cme / geomagnetic\_storm |
| `metrics` | Source-specific values (size, speed, K-index, class) |
| `is_potentially_hazardous` | NEO hazard flag |
| `scraped_at` | ISO timestamp of fetch |

### Data Source

[api.nasa.gov](https://api.nasa.gov) — NASA's open data platform. Public domain
data (17 USC §105). The built-in demo key allows 30 requests/hour; create a free
key at [api.nasa.gov](https://api.nasa.gov) and pass it in `apiKey` for 1,000/hr.

### Use Cases

- **Education & outreach**: daily astronomy images for classrooms and content
- **Media / science comms**: space imagery and asteroid news stories
- **Space industry**: track solar weather that affects satellites and comms
- **Research**: asteroid close-approach data for astrophysics studies
- **Monitoring**: space-weather watch for aurora forecasts and satellite ops

### Limitations

- Built-in demo key: 30 requests/hour. Supply your own key for production volume.
- NEO feed date range caps at 7 days per request.
- APOD is occasionally a video rather than an image (`media_type` distinguishes).

# Actor input Schema

## `apiKey` (type: `string`):

Your personal NASA API key (https://api.nasa.gov). Increases rate limits from 30/hr to 1,000/hr. Leave empty to use the built-in demo key.

## `source` (type: `array`):

Which NASA data sources to fetch. Select one or more.

## `apodCount` (type: `integer`):

How many recent APOD images to fetch (1-30, ordered by date descending).

## `apodSpecificDate` (type: `string`):

Fetch APOD for a specific date (YYYY-MM-DD). Overrides count if set.

## `neoMode` (type: `string`):

Which asteroid query to run. 'feed' by date range, 'browse' for current catalog.

## `neoStartDate` (type: `string`):

Start date for asteroid feed (YYYY-MM-DD). Defaults to today.

## `neoEndDate` (type: `string`):

End date for asteroid feed (YYYY-MM-DD, max 7 days after start). Defaults to start date (single day).

## `maxAsteroids` (type: `integer`):

Maximum number of asteroid records to return.

## `donkiType` (type: `string`):

Which space weather event types to fetch. 'all' returns recent notifications.

## `donkiStartDate` (type: `string`):

Start date for space weather events (YYYY-MM-DD). Defaults to 30 days ago.

## `donkiEndDate` (type: `string`):

End date for space weather events (YYYY-MM-DD). Defaults to today.

## Actor input object example

```json
{
  "apiKey": "",
  "source": [
    "apod",
    "neo",
    "donki"
  ],
  "apodCount": 1,
  "apodSpecificDate": "",
  "neoMode": "feed",
  "neoStartDate": "",
  "neoEndDate": "",
  "maxAsteroids": 100,
  "donkiType": "all",
  "donkiStartDate": "",
  "donkiEndDate": ""
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all scraped records

# 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 = {
    "source": [
        "apod",
        "neo",
        "donki"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("cynix_dev/nasa-space-data").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 = { "source": [
        "apod",
        "neo",
        "donki",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("cynix_dev/nasa-space-data").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "source": [
    "apod",
    "neo",
    "donki"
  ]
}' |
apify call cynix_dev/nasa-space-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cynix_dev/nasa-space-data"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pRShYOt7YVzXu6cX0/builds/DsNUorNB4wxoPJebY/openapi.json
