# NASA JPL Small-Body Database Scraper — Asteroids & Comets (`compute-edge/nasa-sbdb-scraper`) Actor

Extract orbital data for 1.5M+ asteroids and comets from NASA/JPL's Small-Body Database. Filter by NEO status, PHA flag, orbit class. Returns full orbital elements (a, e, i, MOID), absolute magnitude, and orbit classification for planetary science, defense, and education.

- **URL**: https://apify.com/compute-edge/nasa-sbdb-scraper.md
- **Developed by:** [Compute Edge](https://apify.com/compute-edge) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

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

## NASA JPL Small-Body Database Scraper — Asteroids & Comets

Extract comprehensive orbital and physical data for **1.5+ million asteroids, comets, and other small bodies** directly from NASA/JPL's authoritative **Small-Body Database (SBDB) Query API**. This Actor provides instant access to detailed orbital elements, magnitude classifications, and planetary defense metrics — essential for astronomy research, planetary defense, education, and space industry applications.

The SBDB is NASA's primary reference catalog for solar system small bodies, continuously updated with observations and refined orbital parameters. Every asteroid and comet accessible through this Actor comes with validated orbital mechanics data, absolute magnitude, and classification metrics used by scientists and engineers worldwide.

### Key Features

- **1.5M+ small bodies** — Complete asteroid and comet database in a single fetch
- **Full orbital mechanics** — Semi-major axis, eccentricity, inclination, longitude of ascending node, argument of perihelion, mean anomaly, orbital period
- **Planetary defense data** — Earth MOID (Minimum Orbit Intersection Distance), absolute magnitude (H), and PHA (Potentially Hazardous Asteroid) flag
- **NEO filtering** — Isolate Near-Earth Objects (NEO) for space tracking and hazard analysis
- **Orbit classification** — Filter by orbit class (MBA, AMO, APO, IEO, ATE, AST) for research specialization
- **No authentication required** — Free, public NASA API with no rate limits
- **High-precision numeric output** — All orbital elements as floating-point for computational use
- **Clean, research-ready JSON** — Structured output suitable for RAG pipelines, scientific databases, or ML training

### Output Data Fields

| Field | Type | Description |
|-------|------|-------------|
| `fullName` | string | Designations and/or names of the small body (e.g., "1 Ceres", "C/2019 Y4 (ATLAS)") |
| `neo` | boolean | Near-Earth Object flag (Y/N) — bodies with orbits that come within 1.3 AU of Earth |
| `pha` | boolean | Potentially Hazardous Asteroid flag (Y/N) — absolute magnitude ≤ 22 and MOID ≤ 0.05 AU |
| `absoluteMagnitude` | number | Absolute magnitude (H) — intrinsic brightness used to compute size/mass |
| `semiMajorAxisAU` | number | Semi-major axis in AU (Astronomical Units) — defines orbital size |
| `eccentricity` | number | Orbital eccentricity (0 = circular, 1 = parabolic) — defines orbital shape |
| `inclinationDeg` | number | Orbital inclination in degrees — angle above/below ecliptic plane |
| `longitudeOfAscendingNode` | number | Longitude of ascending node in degrees — orbital orientation |
| `argumentOfPerihelion` | number | Argument of perihelion in degrees — angle to closest solar approach |
| `meanAnomaly` | number | Mean anomaly in degrees — position in orbit at epoch |
| `orbitalPeriodDays` | number | Orbital period in days — time to complete one orbit |
| `earthMOID_AU` | number | Minimum Orbit Intersection Distance to Earth in AU — hazard metric |
| `orbitClass` | string | Orbit classification (MBA=Main Belt, AMO=Amor, APO=Apollo, IEO=Aten, ATE=Aten, AST=asteroids, etc.) |
| `firstObservation` | string | Date of earliest observation (YYYY-MM-DD format) |
| `dataProducer` | string | Data source/producer identifier |

### How to Extract Asteroid and Comet Data

1. Navigate to the **NASA JPL Small-Body Database Scraper** on the Apify Store.
2. Click **Start** to open the input configuration.
3. (Optional) Select **Small Body Kind** to filter:
   - "a" = asteroids only (default, ~1.4M bodies)
   - "c" = comets only (~4k bodies)
   - "" = all bodies
4. (Optional) Toggle **Near-Earth Objects Only** to retrieve only NEOs (bodies with orbits crossing Earth's).
5. (Optional) Toggle **Potentially Hazardous Asteroids Only** to focus on high-priority defense-relevant bodies.
6. (Optional) Enter an **Orbit Class Filter** (e.g., "MBA", "AMO", "APO") to narrow by orbital family.
7. Set **Max Results** to control output size (default: 1000, supports up to 50,000).
8. Click **Start** to run.
9. Download results as JSON, CSV, or Excel from the **Dataset** tab.

### Input Example

```json
{
    "sbKind": "a",
    "neoOnly": true,
    "phaOnly": false,
    "orbitClass": "",
    "maxResults": 500
}
````

This fetches up to 500 Near-Earth asteroids with all orbital elements.

### Output Example

```json
{
    "fullName": "99942 Apophis (2004 MN4)",
    "neo": true,
    "pha": true,
    "absoluteMagnitude": 19.7,
    "semiMajorAxisAU": 1.0993,
    "eccentricity": 0.1912,
    "inclinationDeg": 3.3911,
    "longitudeOfAscendingNode": 204.4267,
    "argumentOfPerihelion": 126.4051,
    "meanAnomaly": 285.9715,
    "orbitalPeriodDays": 325.63,
    "earthMOID_AU": 0.0002373,
    "orbitClass": "APO",
    "firstObservation": "2004-06-15",
    "dataProducer": "ORB"
}
```

### Pricing

This Actor queries a free public API in a single HTTP request. Compute usage is minimal.

- **Cost per run**: ~$0.0005–0.001 (single API call, no browser required)
- **Actor start event**: Default platform rate
- **Per-result pricing**: $0.001/result

Typical run time is 10–30 seconds regardless of filter settings.

### Use Cases

- **Planetary defense research** — Track potentially hazardous asteroids and compute collision probabilities
- **Astronomy education** — Build interactive solar system visualizations with real orbital data
- **Space industry** — Assess asteroid mining targets, compute orbital mechanics for mission planning
- **Scientific databases** — Populate research pipelines with authoritative SBDB data
- **LLM training & RAG** — Feed orbital mechanics data to LLMs for space science Q\&A systems
- **Hazard assessment** — Analyze NEO populations, monitor newly discovered bodies, track orbital refinements
- **Citizen science** — Enable crowdsourced asteroid observation and data enrichment programs

### FAQ

**Q: How often is this data updated?**
A: The NASA SBDB is updated continuously as new observations are made and orbital refinements are published. Each run pulls the latest data from NASA's API.

**Q: What is MOID?**
A: Minimum Orbit Intersection Distance — the closest distance between the asteroid's orbit and Earth's orbit. A low MOID (< 0.05 AU) is a key indicator of planetary hazard.

**Q: Are comets included?**
A: Yes. Set "Small Body Kind" to "c" or "" (all bodies) to include comets. Default is asteroids only.

**Q: What does NEO mean?**
A: Near-Earth Object — any small body with an orbit that brings it within 1.3 AU of Earth. These are of highest interest for planetary defense.

**Q: What does PHA mean?**
A: Potentially Hazardous Asteroid — an asteroid with absolute magnitude ≤ 22 (roughly 140m diameter or larger) and MOID ≤ 0.05 AU. PHAs are tracked by planetary defense agencies.

**Q: Can I filter by discovery date?**
A: The current version includes the `firstObservation` field in output, allowing you to post-filter in your pipeline. Future versions may add date-range filtering to the input schema.

**Q: Is this data suitable for ML/AI training?**
A: Yes. The structured orbital mechanics data is ideal for training ML models on solar system dynamics, hazard prediction, or astronomical classification tasks.

### Legal & Attribution

This Actor fetches data from NASA's Small-Body Database, which is in the public domain. No authentication or API key is required. Please attribute NASA/JPL as the data source in any publications or derivative works.

For more information on the SBDB:

- **NASA SSD Small-Body Database**: https://ssd.jpl.nasa.gov/sbdb.html
- **SBDB Query API Documentation**: https://ssd-api.jpl.nasa.gov/doc/sbdb\_query.html

This Actor is provided under the MIT License and is not affiliated with or endorsed by NASA or JPL.

# Actor input Schema

## `sbKind` (type: `string`):

Filter by small body type: 'a' = asteroids only, 'c' = comets only, '' = all bodies.

## `neoOnly` (type: `boolean`):

If enabled, only include Near-Earth Objects (NEO).

## `phaOnly` (type: `boolean`):

If enabled, only include Potentially Hazardous Asteroids (PHA).

## `orbitClass` (type: `string`):

Filter by orbit class (e.g., 'MBA', 'AMO', 'APO', 'AST', 'ATE', 'IEO'). Leave empty for all classes.

## `maxResults` (type: `integer`):

Maximum number of bodies to return (up to 50000).

## Actor input object example

```json
{
  "sbKind": "a",
  "neoOnly": false,
  "phaOnly": false,
  "orbitClass": "",
  "maxResults": 1000
}
```

# Actor output Schema

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

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("compute-edge/nasa-sbdb-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("compute-edge/nasa-sbdb-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 '{}' |
apify call compute-edge/nasa-sbdb-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "NASA JPL Small-Body Database Scraper — Asteroids & Comets",
        "description": "Extract orbital data for 1.5M+ asteroids and comets from NASA/JPL's Small-Body Database. Filter by NEO status, PHA flag, orbit class. Returns full orbital elements (a, e, i, MOID), absolute magnitude, and orbit classification for planetary science, defense, and education.",
        "version": "0.1",
        "x-build-id": "PAA9uTK0G1IV5ildW"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/compute-edge~nasa-sbdb-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-compute-edge-nasa-sbdb-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/compute-edge~nasa-sbdb-scraper/runs": {
            "post": {
                "operationId": "runs-sync-compute-edge-nasa-sbdb-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/compute-edge~nasa-sbdb-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-compute-edge-nasa-sbdb-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": {
                    "sbKind": {
                        "title": "Small Body Kind",
                        "enum": [
                            "a",
                            "c",
                            ""
                        ],
                        "type": "string",
                        "description": "Filter by small body type: 'a' = asteroids only, 'c' = comets only, '' = all bodies.",
                        "default": "a"
                    },
                    "neoOnly": {
                        "title": "Near-Earth Objects Only",
                        "type": "boolean",
                        "description": "If enabled, only include Near-Earth Objects (NEO).",
                        "default": false
                    },
                    "phaOnly": {
                        "title": "Potentially Hazardous Asteroids Only",
                        "type": "boolean",
                        "description": "If enabled, only include Potentially Hazardous Asteroids (PHA).",
                        "default": false
                    },
                    "orbitClass": {
                        "title": "Orbit Class Filter",
                        "type": "string",
                        "description": "Filter by orbit class (e.g., 'MBA', 'AMO', 'APO', 'AST', 'ATE', 'IEO'). Leave empty for all classes.",
                        "default": ""
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Maximum number of bodies to return (up to 50000).",
                        "default": 1000
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
