Skip to content

CLI Installation

Terminal window
go install github.com/peteretelej/nasa/cmd/nasa@latest
Terminal window
nasa --help

Expected output:

Usage: nasa <command> [flags]
Commands:
apod Astronomy Picture of the Day
neo Near-Earth Object Web Service
donki Space Weather (DONKI)
images NASA Image and Video Library
ssd Small-Body Database (SSD/CNEOS)
eonet Earth Observatory Natural Event Tracker
Flags:
--version Print version and exit
--help Show this help message

Set your API key via environment variable:

Terminal window
export NASA_API_KEY="your-registered-key"

The CLI also accepts NASAKEY as a fallback. Without either, it uses NASA’s DEMO_KEY (30 requests/hour).

Most commands also accept --api-key to override per-invocation:

Terminal window
nasa apod --api-key="your-key"

All commands default to formatted table output. Add --json for machine-readable JSON:

Terminal window
nasa apod --json
nasa neo feed --json