惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
博客园 - 叶小钗
J
Java Code Geeks
博客园 - 聂微东
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
美团技术团队
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
罗磊的独立博客
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
小众软件
小众软件

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The SEC has a free financial data API that nobody talks a...
William March · 2026-06-24 · via DEV Community

Every quarterly earnings number for every US public company going back to 2009 is sitting in a free, well-documented JSON API run by the US government. No API key. No rate limit for normal use. No paywall. Almost nobody in the dev community seems to know it exists.

It's at data.sec.gov, and it's the same data Bloomberg charges $24k/year for.

What's in it

The SEC requires all US-listed companies to file financial reports in XBRL — a structured XML format where every number is tagged with a standardised concept name. The EDGAR system has been collecting these since around 2009. The companyfacts endpoint exposes all of it as clean JSON:

GET https://data.sec.gov/api/xbrl/companyfacts/CIK{cik}.json

Where CIK is the company's SEC identifier (10 digits, zero-padded). For Apple, that's 0000320193. The response is a large JSON object with every concept the company has ever reported, broken down by period.

The other endpoint you need is the ticker-to-CIK map:

GET https://www.sec.gov/files/company_tickers.json

This gives you a flat list of all US-listed companies with their CIK, ticker, and name. Load it once and cache it.

One gotcha: concept names vary by company

Companies don't all use the same GAAP concept names to report the same thing. Apple reports revenue as RevenueFromContractWithCustomerExcludingAssessedTax. Older companies use Revenues. Some use SalesRevenueNet. If you just look up one concept name, you'll get blanks for most companies.

The fix is a concept alias map: try each name in order, use the first one that has data.

const CONCEPT_MAP: Record<string, string[]> = {
  revenue: [
    'Revenues',
    'RevenueFromContractWithCustomerExcludingAssessedTax',
    'RevenueFromContractWithCustomerIncludingAssessedTax',
    'SalesRevenueNet',
    'SalesRevenueGoodsNet',
  ],
  netIncome: [
    'NetIncomeLoss',
    'NetIncomeLossAvailableToCommonStockholdersBasic',
    'ProfitLoss',
  ],
  operatingCashFlow: [
    'NetCashProvidedByUsedInOperatingActivities',
    'NetCashProvidedByUsedInOperatingActivitiesContinuingOperations',
  ],
  capex: [
    'PaymentsToAcquirePropertyPlantAndEquipment',
    'PaymentsForCapitalImprovements',
    'CapitalExpenditureDiscontinuedOperations',
  ],
};

function pickConcept(facts: CompanyFacts, names: string[]) {
  for (const name of names) {
    const concept = facts['us-gaap']?.[name];
    if (concept?.units?.USD?.length) return concept.units.USD;
  }
  return null;
}

Another gotcha: Q4 doesn't exist

Companies file 10-Qs for Q1, Q2, Q3. They never file a 10-Q for Q4 — that's folded into the annual 10-K. So the API has no Q4 row.

You synthesise it: Q4 = FY - (Q1 + Q2 + Q3).

This works for flow metrics (revenue, net income, cash flows). For balance sheet items (total assets, equity), they're point-in-time stocks — carry the year-end figure as Q4 rather than doing the arithmetic, because it's the same date.

function synthesiseQ4(
  quarters: Period[],
  annual: Period[]
): Period[] {
  return annual.map(fy => {
    const q1 = quarters.find(q => q.fy === fy.fy && q.fp === 'Q1');
    const q2 = quarters.find(q => q.fy === fy.fy && q.fp === 'Q2');
    const q3 = quarters.find(q => q.fy === fy.fy && q.fp === 'Q3');
    if (!q1 || !q2 || !q3) return null;
    return {
      fy: fy.fy,
      fp: 'Q4',
      end: fy.end,
      val: fy.val - q1.val - q2.val - q3.val,
    };
  }).filter(Boolean);
}

Free cash flow: derive it yourself

Free cash flow isn't an XBRL concept — no company files it. You compute it from the two inputs that are in the data:

FCF = operating cash flow - capex

CapEx is reported as a positive outflow (the company paid $X), so you subtract it. The result is the cash a business generates after maintaining and growing its assets — the number that actually matters for valuation.

The User-Agent requirement

One thing that'll get you 403'd: the SEC requires a non-empty, descriptive User-Agent header with a contact email. Generic headers like Mozilla/5.0 will be rejected.

const headers = {
  'User-Agent': 'YourAppName contact@yourdomain.com',
  'Accept': 'application/json',
};

Use your real email. SEC enforcement is light, but it's a public data service and they ask for it so they can contact you if your scraper goes rogue.

Rate limits

The official guidance is 10 requests/second per IP for the EDGAR APIs. For normal programmatic use you won't hit that. If you're building something with a lot of users hitting it simultaneously, cache aggressively — the underlying data changes at most a few times per quarter.

A Cache-Control: s-maxage=3600, stale-while-revalidate=86400 on your own API layer keeps the SEC request volume low even under traffic.

What you get for free

  • Revenue, net income, EPS, equity for every US public company back to ~2009
  • Full filing history (every 10-K, 10-Q, 8-K, proxy) via data.sec.gov/submissions/CIK{cik}.json
  • Clean JSON, no parsing, no scraping
  • All of it public domain — no license restrictions, no attribution requirements

For most retail-scale use cases, this is everything you need. Bloomberg's $24k/year buys you analyst estimates, real-time quotes, transcripts, and Excel integration on top of this. But the underlying SEC data? Free.


I built Finterm as a free browser-based EDGAR viewer on top of this API — it handles the concept aliasing, Q4 synthesis, and FCF calculation so you can just type a ticker and see the numbers. The full writeup on how it's built (Cloudflare Workers, no Redis, WebGL charts) is on the blog.