# NASA — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Access NASA's suite of open data APIs — including the Astronomy Picture of the Day, Near Earth Object tracking, DONKI space weather events, EPIC Earth imagery, Mars weather, the NASA Image and Video Library, the Exoplanet Archive, and EONET natural events.

**Category:** Government & Public Data | **Website:** [api.nasa.gov/](https://api.nasa.gov/) | **Docs:** [parse.bot/marketplace/fd03028c-26dd-4a43-91cd-a3f4ffbb8f65/api-nasa-gov-api](https://parse.bot/marketplace/fd03028c-26dd-4a43-91cd-a3f4ffbb8f65/api-nasa-gov-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_apod

Get the Astronomy Picture of the Day (APOD) metadata. Returns a single APOD object when date is specified, or a wrapped array ({items: [...]}) when start_date/end_date or count is used. The primary use case is fetching by a single date. Parameters date, count, and start_date/end_date are mutually exclusive; date takes priority.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `count` | integer | No | Return a specified number of random APOD images wrapped in {items: [...]}. Cannot be used with date or start_date/end_date. |
| `date` | string | No | Date of the APOD image in YYYY-MM-DD format. Cannot be used with start_date/end_date or count. Takes priority if multiple are provided. |
| `end_date` | string | No | End date for a range of APODs in YYYY-MM-DD format. Used with start_date. Cannot be used with date or count. |
| `start_date` | string | No | Start date for a range of APODs in YYYY-MM-DD format. Used with end_date. Cannot be used with date or count. |
| `thumbs` | boolean | No | Return URL of video thumbnail if media_type is video. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_apod \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"count":"<integer>","date":"<string>","end_date":"<string>","start_date":"<string>","thumbs":"<boolean>"}'
```

### get_donki_cme

Get Coronal Mass Ejection (CME) events from DONKI. Works reliably for historical date ranges. Very recent or single-day queries may experience intermittent upstream errors.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `endDate` | string | No | End date in YYYY-MM-DD format. Defaults to today. |
| `startDate` | string | No | Start date in YYYY-MM-DD format. Defaults to 30 days prior to today. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_donki_cme \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"endDate":"<string>","startDate":"<string>"}'
```

### get_donki_notifications

Get space weather notifications from DONKI. Returns notification messages with details about space weather events.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `endDate` | string | No | End date in YYYY-MM-DD format. |
| `startDate` | string | No | Start date in YYYY-MM-DD format. |
| `type` | string | No | Notification type filter. Accepted values: 'all', 'FLR', 'SEP', 'CME', 'IPS', 'MPC', 'GST', 'RBE', 'report'. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_donki_notifications \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"endDate":"<string>","startDate":"<string>","type":"<string>"}'
```

### get_eonet_events

Get natural event data from NASA's Earth Observatory Natural Event Tracker (EONET). Returns events such as wildfires, storms, and volcanic eruptions with geolocation data in events array.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Maximum number of events to return. |
| `status` | string | No | Filter by event status: 'open' or 'closed'. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_eonet_events \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","status":"<string>"}'
```

### get_epic_images

Get Earth Polychromatic Imaging Camera (EPIC) imagery metadata from the DSCOVR spacecraft. Returns image metadata wrapped in {images: [...]} for a given date or the most recent available images.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category` | string | No | Image category: 'natural' or 'enhanced'. |
| `date` | string | No | Date of images in YYYY-MM-DD format. If omitted, returns most recent available images. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_epic_images \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"<string>","date":"<string>"}'
```

### get_exoplanet_data

Query the NASA Exoplanet Archive database using TAP (Table Access Protocol) with ADQL queries. Returns results wrapped in {results: [...]}. Note: SQL LIMIT keyword is not supported; use ADQL TOP syntax instead (e.g. 'select top 10 * from ps').

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | No | Full ADQL query string (e.g. 'select top 10 pl_name,hostname from ps where disc_year > 2020'). If not provided, constructs a query from table and where params. LIMIT keyword is not supported; use TOP instead. |
| `table` | string | No | Table name to query when no full query is provided. Default: 'ps' (planetary systems). |
| `where` | string | No | WHERE clause for filtering when no full query is provided (e.g. "pl_name like '%Kepler%'"). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_exoplanet_data \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>","table":"<string>","where":"<string>"}'
```

### get_insight_mars_weather

Get Mars weather data from NASA's InSight lander. Returns the last 7 available sols of weather data including temperature, wind, and pressure. Note: InSight mission ended November 2022; data is historical (sols 675-681, October 2020).

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_insight_mars_weather \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_neo_browse

Browse the overall Asteroid dataset. Returns a paginated list of all Near Earth Objects in the database with orbital data.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_neo_browse \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_neo_feed

Get a list of Near Earth Objects (asteroids) based on their closest approach date to Earth. Returns up to 7 days of data grouped by date. If only start_date is provided, end_date defaults to start_date + 7 days.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `end_date` | string | No | End date for feed in YYYY-MM-DD format. Must be within 7 days of start_date. |
| `start_date` | string | No | Start date for feed in YYYY-MM-DD format. Defaults to today. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_neo_feed \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"end_date":"<string>","start_date":"<string>"}'
```

### get_neo_lookup

Look up a specific Near Earth Object (asteroid) by its NASA JPL small body SPK-ID. Returns detailed orbital and close approach data.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `asteroid_id` | string | Yes | NASA JPL small body SPK-ID of the asteroid (e.g. '2000433' for Eros). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/get_neo_lookup \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asteroid_id":"<string>"}'
```

### search_nasa_library

Search the NASA Image and Video Library. Returns paginated search results with metadata about images, videos, and audio. Results are in collection.items array with data and links for each item.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `media_type` | string | No | Filter by media type: 'image', 'video', or 'audio'. |
| `page` | integer | No | Page number for pagination (1-based). |
| `q` | string | Yes | Search query string. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-api-nasa-gov-api-fd03028c/search_nasa_library \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"media_type":"<string>","page":"<integer>","q":"<string>"}'
```
