This content originally appeared on DEV Community and was authored by Alex Spinov
Your tax dollars paid for these APIs. You might as well use them.
I spent a week exploring government data portals and found some genuinely useful APIs that most developers have never heard of.
1. SEC EDGAR — Every Public Company's Financials
Tesla's revenue? Apple's debt? It's all here. Structured JSON, no API key.
import requests
headers = {"User-Agent": "MyApp (email@example.com)"}
url = "https://data.sec.gov/api/xbrl/companyfacts/CIK0001318605.json"
data = requests.get(url, headers=headers).json()
# Revenue, profit, assets, debt — everything
2. FRED — 816,000 Economic Datasets
Inflation rates, GDP, unemployment, housing prices, interest rates — the Federal Reserve makes it all available.
3. Treasury FiscalData — National Debt in Real-Time
The US national debt, updated daily. Plus exchange rates, auction results, government spending.
4. NASA APIs — Space Data for Free
Asteroid tracking, Mars rover photos, satellite imagery, space weather. Free API key, generous limits.
url = "https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY"
data = requests.get(url).json()
print(data["title"]) # Astronomy Picture of the Day
5. USGS Earthquake API — No Key Needed
Real-time earthquake data worldwide. Updated every minute.
url = "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&minmagnitude=5&limit=5"
data = requests.get(url).json()
for eq in data["features"]:
print(f"{eq["properties"]["mag"]} — {eq["properties"]["place"]}")
6. Census API — US Demographics
Population by zip code, income levels, education, housing — the most detailed demographic data available.
7. Weather.gov — US Weather Forecasts
NOAA's official weather API. No key needed, no rate limit anxiety.
# Get forecast for any US location
url = "https://api.weather.gov/points/40.7128,-74.0060" # NYC
data = requests.get(url, headers={"User-Agent": "MyApp"}).json()
forecast_url = data["properties"]["forecast"]
8. FEC API — Campaign Finance
Who's funding political campaigns? All public. Free API key.
9. PubMed/NIH — 36M Biomedical Papers
Search biomedical literature programmatically. No auth needed.
url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=CRISPR&retmode=json&retmax=5"
data = requests.get(url).json()
ids = data["esearchresult"]["idlist"]
print(f"Found {data["esearchresult"]["count"]} papers on CRISPR")
Why Government APIs Are Underrated
- Free forever — taxpayer funded
- Source of truth — this IS the official data
- Stable — governments don't pivot or shut down APIs for fun
- Well-documented — legal requirements mean good docs
- No vendor lock-in — public data, open formats
I built Python toolkits for all the financial ones
Which government API surprised you the most?
Follow for more free API discoveries.
This content originally appeared on DEV Community and was authored by Alex Spinov
Alex Spinov | Sciencx (2026-03-25T11:04:51+00:00) 9 Government APIs You Didn’t Know Existed (All Free, Most Need No API Key). Retrieved from https://www.scien.cx/2026/03/25/9-government-apis-you-didnt-know-existed-all-free-most-need-no-api-key/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.