SEC EDGAR for Developers: The Free Fundamentals API Hiding in Plain Sight
Most stock-data tutorials skip past the one free, public, no-rate-limit source for US company filings. Here's how to read fundamentals straight from SEC EDGAR, JSON-first.
You finished the comparison shopping between Polygon and Alpha Vantage, maybe even signed up for a free tier of each. Now you want to pull fundamentals — revenue, earnings, free cash flow — for your screener.
Don’t reach for the paid tier just yet. The SEC publishes every
filing from every public US company through a free, well-
structured JSON API at data.sec.gov. It’s unrated, public, and
the data is straight from the source.
What EDGAR actually exposes
Three endpoints do most of the work:
/submissions/CIK{cik}.json— every filing a company has made, with dates, accession numbers, and direct links to the documents./api/xbrl/companyfacts/CIK{cik}.json— every reported XBRL fact for that company, across all filings, indexed by concept (Revenues,NetIncomeLoss,Assets, etc.) and unit./api/xbrl/companyconcept/CIK{cik}/us-gaap/{concept}.json— just one concept across all reported periods.
The companyfacts endpoint is the workhorse. One JSON request
and you have every quarterly and annual fact the company has
filed with the SEC since they switched to XBRL in 2009.
The annoying part: CIK lookup
EDGAR keys companies by CIK (Central Index Key), not ticker. You’ll need to maintain or fetch a ticker → CIK map. The SEC publishes one:
curl -A 'your-name you@example.com' \ https://www.sec.gov/files/company_tickers.jsonThe User-Agent header is required — EDGAR rate-limits anonymous
requests and asks for an identifying string. They throttle at 10
requests/second across all clients; respect it.
A minimal example
Here’s the smallest useful thing — pulling the last 4 quarterly
revenues for Apple (CIK 0000320193):
import requests
headers = {'User-Agent': 'side-project you@example.com'}url = ( 'https://data.sec.gov/api/xbrl/companyconcept/' 'CIK0000320193/us-gaap/Revenues.json')
r = requests.get(url, headers=headers)data = r.json()
# units may include USD and USD/shares; pick USDusd = data['units']['USD']# 10-Q quarterly filings onlyquarterly = [f for f in usd if f.get('form') == '10-Q']quarterly.sort(key=lambda f: f['end'], reverse=True)for f in quarterly[:4]: print(f"{f['end']}: ${f['val']:,}")That’s it. Free, structured, official.
When EDGAR wins
- No rate-limit drama for any volume a side project can generate.
- Authoritative — straight from filings. No vendor between you and the company’s own numbers.
- Historical depth since 2009 for most large filers, earlier in some cases.
Where EDGAR struggles
- Concept fragmentation. Companies don’t all use the same
XBRL concept for the same thing. Apple uses
Revenues; some others have usedSalesRevenueNetor company-specific extensions. Real cleanup work. - Restated filings. When a company restates an earlier quarter, EDGAR contains both the original and the restated values. Your code has to decide which one is “the truth” for backtest purposes.
- Calendar mismatch. Companies report on different fiscal calendars. You can’t naively compare one issuer’s Q1 ending in December to another’s Q1 ending in September.
- No price data. EDGAR is filings, not market data. You still need Polygon, Alpha Vantage, or similar for OHLC.
A reasonable production setup
For a magic-formula-style screener:
- Maintain a local
cik_maptable (refresh weekly from SEC’scompany_tickers.json). - For each ticker in your universe, fetch
companyfactsonce and cache. Refresh on a quarterly cadence — fundamentals don’t change daily. - Normalize concepts to your own internal names (
revenues,net_income,total_assets, etc.) with a hand-curated mapping that tolerates fragmentation. - Get prices from your paid or free price-data API.
- Run your ranking once a week — it’s cheaper than the daily refresh cadence most tutorials suggest.
Closing note
The fundamentals data that paid APIs charge for is largely a cleaned-up, normalized version of what EDGAR already gives you for free. If your project is willing to do the cleanup, EDGAR is the better foundation. If you’d rather pay a vendor to handle the normalization, that’s also a reasonable choice. Either way, knowing the raw source exists changes how you think about the cost of building.
Related reading
2026-05-19
Why Your Backtest Is Lying to You: Data Biases That Ruin Equity Research
Survivorship bias, look-ahead bias, point-in-time data, and the rest of the subtle ways your beautiful backtest is overstating returns. With concrete fixes for each.
2026-05-19
The Boring Math of Compound Returns (And Why Everyone Gets It Wrong)
Compound interest sounds like magic. The math is mundane and the most common rules of thumb are subtly wrong. Here's a calmer take on what compounding actually delivers.
2026-05-19
Index Funds, ETFs, Mutual Funds: What Actually Differs (and When It Matters)
The three labels overlap more than the marketing suggests. A developer-friendly breakdown of structure, tax treatment, and the cases where the difference actually changes your decision.
2026-05-19
Polygon vs Alpha Vantage: Which Stock Data API Fits a Side-Project Budget
Polygon and Alpha Vantage are the two common entry points for developer-side stock data. A side-by-side on free tiers, coverage, and developer experience — without the trading-edge hype.
2026-05-19
What Diversification Actually Buys You (and What It Doesn't)
Diversification reduces idiosyncratic risk, not market risk. When the distinction matters, what correlation looks like under stress, and why 60/40 isn't a free lunch.
Get the best tools, weekly
One email every Friday. No spam, unsubscribe anytime.