DEV Community

Alex Spinov
Alex Spinov

Posted on

7 Free Data APIs That Power My Side Projects (With Code)

I build a lot of side projects. And every single one needs data from somewhere.

After months of trial and error, these are the 7 free APIs I keep coming back to. All of them work without an API key (or with a free one), return real data, and have solid documentation.


1. NASA Open APIs — Space Data for Free

NASA gives away everything: satellite imagery, asteroid data, Mars rover photos, exoplanet catalogs.

import requests

# Astronomy Picture of the Day
apod = requests.get("https://api.nasa.gov/planetary/apod", 
    params={"api_key": "DEMO_KEY"}).json()
print(f"{apod['title']}\n{apod['url']}")

# Near Earth Objects today
neo = requests.get("https://api.nasa.gov/neo/rest/v1/feed/today",
    params={"api_key": "DEMO_KEY"}).json()
print(f"{neo['element_count']} asteroids near Earth today")
Enter fullscreen mode Exit fullscreen mode

Toolkit: nasa-open-data-toolkit


2. World Bank API — Global Economic Data

216 countries, 16,000+ indicators, 60 years of data. GDP, population, CO2, education — everything.

resp = requests.get(
    "https://api.worldbank.org/v2/country/US;CN;IN/indicator/NY.GDP.MKTP.CD",
    params={"format": "json", "date": "2020:2023", "per_page": 20}
).json()[1]

for item in resp[:6]:
    gdp = item['value'] / 1e12 if item['value'] else 0
    print(f"{item['country']['value']} ({item['date']}): ${gdp:.1f}T")
Enter fullscreen mode Exit fullscreen mode

Toolkit: world-bank-data-toolkit


3. USGS Earthquake API — Real-Time Seismic Data

Every earthquake on Earth, updated every minute.

resp = requests.get(
    "https://earthquake.usgs.gov/fdsnws/event/1/query",
    params={"format": "geojson", "minmagnitude": 5, "limit": 5,
            "orderby": "time"}
).json()

for eq in resp['features']:
    props = eq['properties']
    print(f"M{props['mag']}{props['place']}")
Enter fullscreen mode Exit fullscreen mode

Toolkit: earthquake-data-toolkit


4. OpenAlex — 250M+ Academic Papers

Need scholarly data? OpenAlex replaced Microsoft Academic Graph and it's completely free.

resp = requests.get("https://api.openalex.org/works", params={
    "search": "large language models",
    "sort": "cited_by_count:desc",
    "per_page": 3
}).json()

for work in resp['results']:
    print(f"{work['title'][:60]}... ({work['cited_by_count']} citations)")
Enter fullscreen mode Exit fullscreen mode

Toolkit: openalex-research-toolkit


5. Crossref — 150M+ Scholarly Articles by DOI

The official DOI registry. Look up any DOI and get full metadata.

article = requests.get(
    "https://api.crossref.org/works/10.1038/nature12373"
).json()['message']

print(f"{article['title'][0]}")
print(f"Cited by {article['is-referenced-by-count']} papers")
Enter fullscreen mode Exit fullscreen mode

Toolkit: crossref-research-toolkit


6. Open-Meteo — Weather Data Without API Key

No signup. No API key. Just send a request.

resp = requests.get("https://api.open-meteo.com/v1/forecast", params={
    "latitude": 40.71, "longitude": -74.01,  # NYC
    "current_weather": True
}).json()

w = resp['current_weather']
print(f"NYC: {w['temperature']}°C, wind {w['windspeed']} km/h")
Enter fullscreen mode Exit fullscreen mode

7. REST Countries — 250 Countries Data

Population, languages, currencies, timezones — all countries.

countries = requests.get("https://restcountries.com/v3.1/all",
    params={"fields": "name,population,capital"}).json()

# Top 5 by population
top = sorted(countries, key=lambda c: c['population'], reverse=True)[:5]
for c in top:
    pop = c['population'] / 1e9
    print(f"{c['name']['common']}: {pop:.2f}B")
Enter fullscreen mode Exit fullscreen mode

Quick Reference Table

API Data Key? Best For
NASA Space, satellites, asteroids DEMO_KEY Space projects, education
World Bank Economics, demographics No Data visualization, research
USGS Earthquakes, real-time No Maps, alerts, dashboards
OpenAlex 250M+ academic papers No Research tools, bibliometrics
Crossref 150M+ DOI metadata No Citation analysis, bibliographies
Open-Meteo Weather, forecasts No Weather apps, dashboards
REST Countries Country data No Geography projects

All My Open Source Toolkits

I build Python toolkits for free APIs:

All MIT licensed. Star the ones you find useful.


What free API would you add to this list? I'm always looking for new ones.

Building something with data APIs? Check my GitHub — I might have a toolkit for it.

Top comments (0)