# NASA API

> NASA returns astronomy pictures, space media, asteroid approaches, natural events, and ISS sightings as a workflow and API.

NASA (National Aeronautics and Space Administration) returns dated astronomy pictures when you provide a date, or uses today by default. Search images finds photos, videos, or audio using required search words and optional year and media filters. List near earth asteroids, List natural events, and Get iss sightings return approaches, events, and city sightings using dates, filters, or a city.

- Page: https://fous.com/workflows/nasa
- Handle: `@nasa`
- Category: [Science](https://fous.com/workflows/category/science)
- Source website: https://nasa.gov
- Last verified: Sep 29, 2026
- Fous is not affiliated with NASA.

## Methods

### Get astronomy picture of the day

Operation `get_astronomy_picture_of_the_day`, version 1. 1 credit per call.

Get the Astronomy Picture of the Day, its explanation, media links, and credits for a date. Dates start June 16, 1995; today’s entry may not be published yet.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `date` | string | no | `"2026-09-28"` | Picture date in YYYY-MM-DD, such as 2025-09-14. Defaults to today. |

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "Picture date in YYYY-MM-DD, such as 2025-09-14. Defaults to today.",
      "examples": [
        "2026-09-28",
        "2025-09-14",
        "2025-03-22"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "date": "2026-09-28"
    },
    {
      "date": "2025-09-14"
    },
    {
      "date": "2025-03-22"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `date` | string | `"2026-09-28"` | Date of this APOD entry. |
| `title` | string | `"Cosmic Latte: The Average Color of the Universe"` | Title of the picture. |
| `credit` | string or null | `"Karl Glazebrook & Ivan Baldry (JHU)"` | Image or video credit as plain text, if listed. |
| `copyright` | string or null | `"Telescope Live, Heaven's Mirror Observatory; Processing: Chris Cantrell"` | Copyright information as plain text, if listed. |
| `page_link` | string | `"https://apod.nasa.gov/apod/ap260928.html"` | APOD page for this date. |
| `media_link` | string | `"https://apod.nasa.gov/apod/image/2609/CosmicLatte_jhu_960_annotated.jpg"` | Link to the featured image or video. |
| `media_type` | string | `"image"` | Type of featured media. |
| `explanation` | string |  | Explanation in plain text. |
| `high_resolution_image_link` | string or null | `"https://apod.nasa.gov/apod/image/2609/CosmicLatte_jhu_960.jpg"` | Higher-resolution image link, if one is provided. |

**Example input**

```json
{
  "date": "2026-09-28"
}
```

**Example output**

```json
{
  "date": "2026-09-28",
  "title": "Cosmic Latte: The Average Color of the Universe",
  "credit": "Karl Glazebrook & Ivan Baldry (JHU)",
  "copyright": null,
  "page_link": "https://apod.nasa.gov/apod/ap260928.html",
  "media_link": "https://apod.nasa.gov/apod/image/2609/CosmicLatte_jhu_960_annotated.jpg",
  "media_type": "image",
  "explanation": "What color is the universe? More precisely, if the entire sky were smeared out, what color would the final mix be? This whimsical question came up when trying to determine what stars are commonplace i…",
  "high_resolution_image_link": "https://apod.nasa.gov/apod/image/2609/CosmicLatte_jhu_960.jpg"
}
```

### Get iss sightings

Operation `get_iss_sightings`, version 1. 1 credit per call.

Find upcoming International Space Station sightings for a city in NASA’s city list, with local start times, visibility and sky directions. Cities without scheduled passes return an empty list.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `city` | string | yes | `"London, United Kingdom"` | City followed by its state or country, for example Chicago, Illinois or Manchester, United Kingdom. |
| `max_results` | integer | no | `1` | Maximum number of upcoming sightings to return, for example 10. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "city"
  ],
  "properties": {
    "city": {
      "type": "string",
      "description": "City followed by its state or country, for example Chicago, Illinois or Manchester, United Kingdom.",
      "examples": [
        "London, United Kingdom",
        "Chicago, Illinois",
        "Manchester, United Kingdom"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 10,
      "maximum": 30,
      "minimum": 1,
      "description": "Maximum number of upcoming sightings to return, for example 10.",
      "x-fous-developer": true,
      "examples": [
        1
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "city": "London, United Kingdom",
      "max_results": 1
    },
    {
      "city": "Chicago, Illinois"
    },
    {
      "city": "Manchester, United Kingdom"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `sightings` | array |  |  |
| `sightings[].date` | string | `"2026-09-29"` |  |
| `sightings[].appears` | string | `"10° above WSW"` |  |
| `sightings[].page_link` | string | `"https://iss-sts.hqmce.nasa.gov/iss-sts-cities-html/United_Kingdom-England-London.html"` |  |
| `sightings[].disappears` | string | `"10° above SSW"` |  |
| `sightings[].local_start_time` | string | `"2026-09-29T19:38:00+01:00"` |  |
| `sightings[].maximum_height_degrees` | integer | `11` |  |
| `sightings[].visible_duration_minutes` | integer | `2` |  |
| `matched_city` | string | `"London, England, United Kingdom"` | Matched city and region or country. |

**Example input**

```json
{
  "city": "London, United Kingdom",
  "max_results": 1
}
```

**Example output**

```json
{
  "sightings": [
    {
      "date": "2026-09-29",
      "appears": "10° above WSW",
      "page_link": "https://iss-sts.hqmce.nasa.gov/iss-sts-cities-html/United_Kingdom-England-London.html",
      "disappears": "10° above SSW",
      "local_start_time": "2026-09-29T19:38:00+01:00",
      "maximum_height_degrees": 11,
      "visible_duration_minutes": 2
    }
  ],
  "matched_city": "London, England, United Kingdom"
}
```

### List natural events

Operation `list_natural_events`, version 1. 1 credit per call.

List EONET natural events with latest observations in the past number of days, most recent first. A country or region filter matches reported event locations against mapped boundaries; locations and ongoing status are approximate, and not all events have a reported size or strength.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `days_back` | integer | no | `30` | Include observations from this many days including today, for example 30. |
| `open_only` | boolean | no | `true` | Include only ongoing events, for example true. |
| `event_type` | string | no | `"wildfires"` | Event category, for example wildfires. |
| `max_results` | integer | no | `20` | Maximum number of events to return, for example 50. |
| `country_or_region` | string | no | `"California"` | Country or region name to restrict results, for example California or Australia. Leave blank for anywhere. |

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "days_back": {
      "type": "integer",
      "default": 30,
      "maximum": 365,
      "minimum": 1,
      "description": "Include observations from this many days including today, for example 30.",
      "examples": [
        30,
        14
      ]
    },
    "open_only": {
      "type": "boolean",
      "default": true,
      "description": "Include only ongoing events, for example true.",
      "examples": [
        true,
        false
      ]
    },
    "event_type": {
      "enum": [
        "any",
        "wildfires",
        "volcanoes",
        "severe_storms",
        "sea_and_lake_ice",
        "floods",
        "dust_and_haze"
      ],
      "type": "string",
      "default": "any",
      "description": "Event category, for example wildfires.",
      "examples": [
        "wildfires",
        "severe_storms",
        "volcanoes"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 50,
      "maximum": 200,
      "minimum": 1,
      "description": "Maximum number of events to return, for example 50.",
      "x-fous-developer": true,
      "examples": [
        20,
        15
      ]
    },
    "country_or_region": {
      "type": "string",
      "default": "",
      "description": "Country or region name to restrict results, for example California or Australia. Leave blank for anywhere.",
      "examples": [
        "California"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "days_back": 30,
      "open_only": true,
      "event_type": "wildfires",
      "max_results": 20,
      "country_or_region": "California"
    },
    {
      "days_back": 30,
      "open_only": false,
      "event_type": "severe_storms",
      "max_results": 15
    },
    {
      "days_back": 14,
      "open_only": true,
      "event_type": "volcanoes",
      "max_results": 20
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `events` | array |  | Matching natural events, most recent observation first. |
| `events[].ongoing` | string | `"yes"` | Whether EONET still considers the event open. |
| `events[].latitude` | number or null | `36.601661` | Latest reported latitude. |
| `events[].longitude` | number or null | `-118.9721` | Latest reported longitude. |
| `events[].page_link` | string | `"https://eonet.gsfc.nasa.gov/api/v3/events/EONET_24810"` | Page for this event at EONET. |
| `events[].event_name` | string | `"Prescribed Fire CRAWFORD CORRAL RX, Tulare, California"` | Natural event name. |
| `events[].event_type` | string | `"Wildfires"` | EONET event category. |
| `events[].source_links` | array |  | Links supplied by event sources. |
| `events[].eonet_event_id` | string | `"EONET_24810"` | EONET event identifier. |
| `events[].size_or_strength` | string or null | `"690 acres"` | Latest reported magnitude and unit, when available. |
| `events[].latest_observation_date` | string | `"2026-09-19"` | Date of the latest reported observation. |

**Example input**

```json
{
  "days_back": 30,
  "open_only": true,
  "event_type": "wildfires",
  "max_results": 20,
  "country_or_region": "California"
}
```

**Example output**

```json
{
  "events": [
    {
      "ongoing": "yes",
      "latitude": 36.601661,
      "longitude": -118.9721,
      "page_link": "https://eonet.gsfc.nasa.gov/api/v3/events/EONET_24810",
      "event_name": "Prescribed Fire CRAWFORD CORRAL RX, Tulare, California",
      "event_type": "Wildfires",
      "source_links": [
        "https://irwin.doi.gov/observer/incidents/2026-CATUU-000092"
      ],
      "eonet_event_id": "EONET_24810",
      "size_or_strength": "690 acres",
      "latest_observation_date": "2026-09-19"
    },
    {
      "ongoing": "yes",
      "latitude": 39.394425,
      "longitude": -120.025216,
      "page_link": "https://eonet.gsfc.nasa.gov/api/v3/events/EONET_24488",
      "event_name": "Wildfire FLORISTON, Nevada, California",
      "event_type": "Wildfires",
      "source_links": [
        "https://irwin.doi.gov/observer/incidents/2026-CANEU-029037"
      ],
      "eonet_event_id": "EONET_24488",
      "size_or_strength": "610 acres",
      "latest_observation_date": "2026-09-16"
    },
    {
      "ongoing": "yes",
      "latitude": 37.5662,
      "longitude": -119.616167,
      "page_link": "https://eonet.gsfc.nasa.gov/api/v3/events/EONET_24484",
      "event_name": "Wildfire DOME, Mariposa, California",
      "event_type": "Wildfires",
      "source_links": [
        "https://irwin.doi.gov/observer/incidents/2026-CAYNP-000100"
      ],
      "eonet_event_id": "EONET_24484",
      "size_or_strength": "1177 acres",
      "latest_observation_date": "2026-09-15"
    }
  ]
}
```

### List near earth asteroids

Operation `list_near_earth_asteroids`, version 1. 1 credit per call.

List near-Earth asteroids approaching Earth between two dates within a chosen distance, with UTC approach times, size ranges, speed, and hazard status. Dates are inclusive UTC calendar days; measured size ranges use one standard deviation, and other sizes are estimated from brightness.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `end_date` | string | no | `"2026-10-06"` | Last UTC calendar day to include, for example 2026-10-06. Defaults to seven days after the start date and cannot be later. |
| `start_date` | string | no | `"2026-09-29"` | First UTC calendar day to include, for example 2026-09-29. Defaults to today. |
| `max_distance_miles` | number | no | `5000000` | Maximum Earth miss distance in miles, for example 5000000. Defaults to 5,000,000 miles. |

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "end_date": {
      "type": "string",
      "format": "date",
      "description": "Last UTC calendar day to include, for example 2026-10-06. Defaults to seven days after the start date and cannot be later.",
      "examples": [
        "2026-10-06",
        "2029-04-20",
        "2029-04-13"
      ]
    },
    "start_date": {
      "type": "string",
      "format": "date",
      "description": "First UTC calendar day to include, for example 2026-09-29. Defaults to today.",
      "examples": [
        "2026-09-29",
        "2029-04-13"
      ]
    },
    "max_distance_miles": {
      "type": "number",
      "default": 5000000,
      "minimum": 0,
      "description": "Maximum Earth miss distance in miles, for example 5000000. Defaults to 5,000,000 miles.",
      "examples": [
        5000000,
        100
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "end_date": "2026-10-06",
      "start_date": "2026-09-29"
    },
    {
      "end_date": "2029-04-20",
      "start_date": "2029-04-13",
      "max_distance_miles": 5000000
    },
    {
      "end_date": "2029-04-13",
      "start_date": "2029-04-13",
      "max_distance_miles": 100
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `asteroids` | array |  | Asteroid approaches ordered by closest approach time in UTC. Empty if none match. |
| `asteroids[].speed_kmh` | number | `55952.26` |  |
| `asteroids[].speed_mph` | number | `34767.13` |  |
| `asteroids[].size_basis` | string | `"estimated from brightness"` | Measured diameter or estimated from brightness; unavailable if no size or brightness is known. |
| `asteroids[].asteroid_name` | string | `"2026 RE51"` | Asteroid name or designation. |
| `asteroids[].jpl_page_link` | string | `"https://ssd.jpl.nasa.gov/tools/sbdb_lookup.html#/?sstr=2026%20RE51"` |  |
| `asteroids[].size_max_feet` | number or null | `263.41` |  |
| `asteroids[].size_min_feet` | number or null | `117.8` |  |
| `asteroids[].size_max_meters` | number or null | `80.29` |  |
| `asteroids[].size_min_meters` | number or null | `35.91` |  |
| `asteroids[].miss_distance_km` | number | `7716401.84` |  |
| `asteroids[].miss_distance_miles` | number | `4794749.81` |  |
| `asteroids[].potentially_hazardous` | string | `"no"` |  |
| `asteroids[].closest_approach_time_utc` | string | `"2026-09-29T16:21:21+00:00"` | Closest approach in UTC (ISO 8601). |
| `asteroids[].miss_distance_moon_distances` | number | `20.0739` |  |

**Example input**

```json
{
  "end_date": "2026-10-06",
  "start_date": "2026-09-29"
}
```

**Example output**

```json
{
  "asteroids": [
    {
      "speed_kmh": 55952.26,
      "speed_mph": 34767.13,
      "size_basis": "estimated from brightness",
      "asteroid_name": "2026 RE51",
      "jpl_page_link": "https://ssd.jpl.nasa.gov/tools/sbdb_lookup.html#/?sstr=2026%20RE51",
      "size_max_feet": 263.41,
      "size_min_feet": 117.8,
      "size_max_meters": 80.29,
      "size_min_meters": 35.91,
      "miss_distance_km": 7716401.84,
      "miss_distance_miles": 4794749.81,
      "potentially_hazardous": "no",
      "closest_approach_time_utc": "2026-09-29T16:21:21+00:00",
      "miss_distance_moon_distances": 20.0739
    },
    {
      "speed_kmh": 37043.73,
      "speed_mph": 23017.91,
      "size_basis": "estimated from brightness",
      "asteroid_name": "2026 SB12",
      "jpl_page_link": "https://ssd.jpl.nasa.gov/tools/sbdb_lookup.html#/?sstr=2026%20SB12",
      "size_max_feet": 167.04,
      "size_min_feet": 74.7,
      "size_max_meters": 50.91,
      "size_min_meters": 22.77,
      "miss_distance_km": 3887673.64,
      "miss_distance_miles": 2415688.41,
      "potentially_hazardous": "no",
      "closest_approach_time_utc": "2026-09-30T09:17:28+00:00",
      "miss_distance_moon_distances": 10.1136
    },
    {
      "speed_kmh": 21657.12,
      "speed_mph": 13457.11,
      "size_basis": "estimated from brightness",
      "asteroid_name": "2026 RS",
      "jpl_page_link": "https://ssd.jpl.nasa.gov/tools/sbdb_lookup.html#/?sstr=2026%20RS",
      "size_max_feet": 137.6,
      "size_min_feet": 61.54,
      "size_max_meters": 41.94,
      "size_min_meters": 18.76,
      "miss_distance_km": 4279439.48,
      "miss_distance_miles": 2659120.41,
      "potentially_hazardous": "no",
      "closest_approach_time_utc": "2026-09-30T10:16:52+00:00",
      "miss_distance_moon_distances": 11.1328
    }
  ]
}
```

### Search images

Operation `search_images`, version 1. 1 credit per call.

Search NASA public photos, videos, or audio by words and creation year. Returns up to 100 matches in relevance order; thumbnails and credits may be missing.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `query` | string | yes | `"Saturn rings"` | Words to search for, for example Saturn rings. |
| `end_year` | integer | no | `1970` | Latest creation year, for example 1970. |
| `media_type` | string | no | `"video"` | Type of media to find, for example image. |
| `start_year` | integer | no | `1969` | Earliest creation year, for example 1969. |
| `max_results` | integer | no | `3` | Maximum matches to return, for example 20. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Words to search for, for example Saturn rings.",
      "examples": [
        "Saturn rings",
        "Apollo 11 launch",
        "Apollo 11"
      ]
    },
    "end_year": {
      "type": "integer",
      "maximum": 2100,
      "minimum": 1800,
      "description": "Latest creation year, for example 1970.",
      "examples": [
        1970
      ]
    },
    "media_type": {
      "enum": [
        "image",
        "video",
        "audio"
      ],
      "type": "string",
      "default": "image",
      "description": "Type of media to find, for example image.",
      "examples": [
        "video",
        "audio"
      ]
    },
    "start_year": {
      "type": "integer",
      "maximum": 2100,
      "minimum": 1800,
      "description": "Earliest creation year, for example 1969.",
      "examples": [
        1969
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 100,
      "minimum": 1,
      "description": "Maximum matches to return, for example 20.",
      "x-fous-developer": true,
      "examples": [
        3,
        4,
        2
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "query": "Saturn rings"
    },
    {
      "query": "Apollo 11 launch",
      "media_type": "video",
      "max_results": 3
    },
    {
      "query": "Apollo 11 launch",
      "end_year": 1970,
      "start_year": 1969,
      "max_results": 4
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `results` | array |  |  |
| `results[].title` | string or null | `"Return to the Pad: Astronaut Michael Collins Reflects on Apollo 11 Launch - Crew Quarters Tour with Bob Cabana"` |  |
| `results[].keywords` | array |  |  |
| `results[].page_link` | string | `"https://images.nasa.gov/details/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3226478"` |  |
| `results[].description` | string or null | `"Return to the Pad: Astronaut Michael Collins Reflects on Apollo 11 Launch"` |  |
| `results[].nasa_center` | string or null | `"Kennedy Space Center"` |  |
| `results[].date_created` | string or null | `"2019-07-16"` |  |
| `results[].nasa_media_id` | string | `"KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3226478"` |  |
| `results[].full_size_link` | string or null | `"https://images-assets.nasa.gov/video/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-32264` |  |
| `results[].thumbnail_link` | string or null | `"https://images-assets.nasa.gov/video/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-32264` |  |
| `results[].photographer_or_credit` | string or null | `"NASA HQ"` |  |

**Example input**

```json
{
  "query": "Apollo 11 launch",
  "media_type": "video",
  "max_results": 3
}
```

**Example output**

```json
{
  "results": [
    {
      "title": "Return to the Pad: Astronaut Michael Collins Reflects on Apollo 11 Launch - Crew Quarters Tour with Bob Cabana",
      "keywords": [
        "launch pad"
      ],
      "page_link": "https://images.nasa.gov/details/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3226478",
      "description": "Return to the Pad: Astronaut Michael Collins Reflects on Apollo 11 Launch",
      "nasa_center": "Kennedy Space Center",
      "date_created": "2019-07-16",
      "nasa_media_id": "KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3226478",
      "full_size_link": "https://images-assets.nasa.gov/video/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3226478/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3…",
      "thumbnail_link": "https://images-assets.nasa.gov/video/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3226478/KSC-20190716-MH-NAS01_0001-Return_to_the_Pad_Crew_Quarters_Broll_HQ_Provided-3…",
      "photographer_or_credit": "NASA HQ"
    }
  ]
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@nasa",
  "visibility": "public",
  "operation": "get_astronomy_picture_of_the_day",
  "version": 1,
  "input": {
    "date": "2026-09-28"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@nasa\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_astronomy_picture_of_the_day\",\n  \"version\": 1,\n  \"input\": {\n    \"date\": \"2026-09-28\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@nasa",
  "visibility": "public",
  "operation": "get_astronomy_picture_of_the_day",
  "version": 1,
  "input": {
    "date": "2026-09-28"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@nasa","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Find NASA media about a topic and creation year
- Review asteroid approach distances, speeds, sizes, and hazard status
- Track recent natural events by type or region
- Plan when to watch the ISS from a city
- Retrieve astronomy pictures and explanations for selected dates

## FAQ

### Is Fous affiliated with NASA?

No. Fous is not affiliated with NASA. This workflow reads the public nasa.gov website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a NASA account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from nasa.gov when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

### What is NASA’s astronomy picture for a date?

Get astronomy picture of the day returns the picture title, explanation, media links, and credits for the date you provide.

### Which asteroids will approach Earth during a date range?

List near earth asteroids returns matching approaches, closest approach times, distances, speeds, size ranges, and hazard status.

### When can I see the ISS from my city?

Get iss sightings returns upcoming sightings for a city, including local start times, visibility duration, and sky directions.

## Related

- [USGS Earthquakes API](https://fous.com/workflows/usgs-earthquakes.md): USGS Earthquakes provides recent event details, nearby earthquake distances and local times, and significant worldwide events from the past day, week, or month; some impact, felt, and alert information may be unavailable.
- [National Archives API](https://fous.com/workflows/national-archives.md): Search the public U.S. National Archives Catalog for historical records.
- [NPR API](https://fous.com/workflows/npr.md): NPR returns displayed section headlines, searchable articles with summaries and publication details, and available article text; date-filtered searches may miss older stories edited much later.
- [AP News API](https://fous.com/workflows/ap-news.md): AP News provides reporting, up to 50 public-page headlines, searchable articles visible in its search, and full text when accessible.
- [The Space Devs API](https://fous.com/workflows/the-space-devs.md): The Space Devs provides worldwide rocket launch schedules and mission details; public development listings may lag, and some launch details may be missing.
- [Google Search API](https://fous.com/workflows/google-search.md): Google Search returns public web, image, job, event, related-question, and autocomplete results in Google’s order, with answers and details when available; results may be fewer, omit information, or be empty.
- [NOAA Space Weather API](https://fous.com/workflows/noaa-space-weather.md): NOAA Space Weather provides near-term aurora chances, current geomagnetic activity, a three-day Kp outlook, and NOAA alerts from the past 1–7 days.
- [Wayback Machine API](https://fous.com/workflows/wayback-machine.md): Wayback Machine lets you explore archived websites, find the closest page capture to a past date, and review captures over time; the nearest capture may fall outside the requested period.
- [All Science workflows](https://fous.com/workflows/category/science)
