Last month my kid asked me: "When is the next SpaceX rocket launching?"
I checked 3 websites. Different dates. Different payload names. Confusing countdown timers.
So I did what any developer would do — I built my own tracker. 50 lines. No API key. Free forever.
The API Nobody Talks About
The SpaceX REST API is completely free, requires no authentication, and returns beautifully structured JSON about every launch since 2006.
No rate limits published (be reasonable). No signup. Just requests.get() and go.
The Code
import requests
from datetime import datetime
def get_next_launch():
r = requests.get("https://api.spacexdata.com/v5/launches/next")
launch = r.json()
name = launch["name"]
date = datetime.fromisoformat(launch["date_utc"].replace("Z", "+00:00"))
days_until = (date - datetime.now(date.tzinfo)).days
print(f"Next Launch: {name}")
print(f"Date: {date.strftime("%B %d, %Y at %H:%M UTC")}")
print(f"{days_until} days from now")
return launch
def get_launch_stats():
r = requests.get("https://api.spacexdata.com/v5/launches")
launches = r.json()
total = len(launches)
successes = sum(1 for l in launches if l["success"] is True)
failures = sum(1 for l in launches if l["success"] is False)
print(f"SpaceX Launch History:")
print(f" Total launches: {total}")
print(f" Successes: {successes} ({successes/total*100:.1f}%)")
print(f" Failures: {failures}")
return launches
def get_crew_missions():
r = requests.get("https://api.spacexdata.com/v4/crew")
crew = r.json()
agencies = {}
for member in crew:
agency = member.get("agency", "Unknown")
agencies[agency] = agencies.get(agency, 0) + 1
print(f"Crew Members: {len(crew)}")
for agency, count in sorted(agencies.items(), key=lambda x: -x[1])[:5]:
print(f" {agency}: {count}")
if __name__ == "__main__":
get_next_launch()
get_launch_stats()
get_crew_missions()
What You Get
Next Launch: Starlink Group 12-7
Date: April 02, 2026 at 14:30 UTC
8 days from now
SpaceX Launch History:
Total launches: 267
Successes: 261 (97.8%)
Failures: 4
Crew Members: 30
NASA: 18
SpaceX: 4
JAXA: 3
5 Things I Learned
- SpaceX has a 97.8% success rate — I had no idea it was that high
- The API has data from 2006 — Falcon 1 first (failed) launch is in there
-
You can track Starlink satellites —
/starlinkendpoint with orbital data - Crew data includes Wikipedia links — great for building info cards
- Rocket reuse data is available — how many times each booster has flown
Other Endpoints Worth Exploring
| Endpoint | What You Get |
|---|---|
/v4/rockets |
Specs for every rocket (height, mass, thrust) |
/v4/starlink |
4,000+ satellite positions |
/v4/landpads |
Landing pad locations and stats |
/v5/launches/past |
Every historical launch |
/v4/crew |
Astronaut profiles |
Build Ideas
-
Launch notification bot — check
/launches/nextdaily, send Telegram/Discord alert - Success rate dashboard — chart success rates by year
- Starlink coverage map — plot satellite positions on a map
- Rocket comparison tool — Falcon 9 vs Starship specs side by side
I maintain a collection of 25+ Python API clients for free APIs (weather, finance, space, news): github.com/spinov001-art
What free APIs do you use in your projects? Drop a comment — I am always looking for new ones to add to the collection.
Top comments (0)