DEV Community

Alex Spinov
Alex Spinov

Posted on

5 Government APIs That Give You Data Worth Thousands (For Free)

Most developers know about the big public APIs — Twitter, GitHub, Google Maps. But there's a goldmine of government data APIs that almost nobody uses.

These APIs provide data that consulting firms charge thousands for. Market research, economic indicators, patent filings, import/export data — all free, no API key needed.

1. FRED API — 800,000+ Economic Time Series

The Federal Reserve Economic Data API gives you access to every major economic indicator: GDP, unemployment, inflation, interest rates, housing prices, stock indices.

import httpx

# No API key needed for basic access
url = "https://api.stlouisfed.org/fred/series/observations"
params = {
    "series_id": "GDP",
    "api_key": "DEMO_KEY",  # Get free key at fred.stlouisfed.org
    "file_type": "json",
    "observation_start": "2020-01-01"
}
data = httpx.get(url, params=params).json()
for obs in data['observations'][-5:]:
    print(f"{obs['date']}: ${float(obs['value']):,.0f}B")
Enter fullscreen mode Exit fullscreen mode

Why this is valuable: Investment firms pay $50K+ for Bloomberg terminals. FRED gives you 80% of the same macro data for free.

My FRED tool →

2. USPTO API — Patent Search

Search every US patent ever filed. Free. No key needed.

url = "https://developer.uspto.gov/ibd-api/v1/application/publications"
params = {"searchText": "artificial intelligence", "start": 0, "rows": 10}
patents = httpx.get(url, params=params).json()
for p in patents['results']:
    print(f"{p['patentApplicationNumber']}{p['inventionTitle']}")
Enter fullscreen mode Exit fullscreen mode

Why this is valuable: Patent research firms charge $500-2000 per search. You can automate it.

3. Census Bureau API — Demographics for Any ZIP Code

Population, income, education, housing — down to census tract level.

# No key needed for most endpoints
url = "https://api.census.gov/data/2022/acs/acs5"
params = {
    "get": "NAME,B01001_001E,B19013_001E",  # Name, population, median income
    "for": "zip code tabulation area:10001",  # Manhattan ZIP
}
data = httpx.get(url, params=params).json()
headers, values = data[0], data[1]
print(dict(zip(headers, values)))
# {'NAME': 'ZCTA5 10001', 'population': '21102', 'median_income': '$112,586'}
Enter fullscreen mode Exit fullscreen mode

Why this is valuable: Market research firms charge $5K-20K for demographic reports. This data is the same source they use.

4. World Bank API — Global Development Data

GDP, population, trade data for every country. 16,000+ indicators.

url = "https://api.worldbank.org/v2/country/US;CN;IN/indicator/NY.GDP.MKTP.CD"
params = {"format": "json", "date": "2020:2024", "per_page": 50}
data = httpx.get(url, params=params).json()[1]
for d in data[:6]:
    if d['value']:
        print(f"{d['country']['value']} ({d['date']}): ${d['value']/1e12:.1f}T")
Enter fullscreen mode Exit fullscreen mode

My World Bank tool →

5. SEC EDGAR API — Public Company Filings

Every 10-K, 10-Q, and 8-K filing from every public company. Free full-text search.

url = "https://efts.sec.gov/LATEST/search-index"
params = {"q": '"artificial intelligence"', "dateRange": "custom",
          "startdt": "2024-01-01", "enddt": "2024-12-31", "forms": "10-K"}
headers = {"User-Agent": "MyApp myemail@example.com"}
results = httpx.get(url, params=params, headers=headers).json()
Enter fullscreen mode Exit fullscreen mode

Why this is valuable: Financial data providers like Capital IQ charge $20K+/year. EDGAR is free and has the same underlying data.

The Pattern

Notice something? All these APIs are free because they're funded by taxpayers. The data exists for public benefit, but most developers don't know it's available programmatically.

Consulting firms have built billion-dollar businesses by putting nice dashboards on top of free government data.

What Would You Build?

If you had easy access to all this data, what would you build? I'm curious what projects people would start.


I maintain a list of 200+ free APIs including all the ones above. Star it if you find it useful.

Top comments (0)