DEV Community

Your Evenings Data
Your Evenings Data

Posted on

SEC EDGAR API in Python: a company's 10-K, 10-Q and 8-K filings by ticker into a CSV (no API key)

Article type: How-to guide (one task: turn a list of tickers into a CSV of each company's 10-K, 10-Q and 8-K filings from SEC EDGAR)

Prerequisites: Python 3 with requests (pip install requests). No API key or account: the SEC's EDGAR APIs are free and public. An Apify account only if you use the hosted version at the end.

Tested on: 15 November 2026, against the live SEC endpoints.

You follow a handful of companies and want their annual reports, quarterly reports and 8-K event filings in one table: for a research log, a watchlist, or to feed a spreadsheet. SEC EDGAR has this for every US public company, and the SEC publishes it as JSON at data.sec.gov. No scraping is needed.

All the data in this post comes from two SEC files:

File URL What it gives you
Ticker list https://www.sec.gov/files/company_tickers.json Ticker, company name and CIK (the SEC's company number)
Submissions https://data.sec.gov/submissions/CIK##########.json The company's filing history: form, filing date, period, 8-K item numbers and the main document for each filing

The SEC's API page says these need no authentication or keys. Its fair-access rules ask for two things: declare a User-Agent with your name and email, and stay under 10 requests a second.

How do I get a company's filings by ticker?

The script looks up each ticker's CIK, reads its submissions file, keeps 10-K, 10-Q and 8-K filings (and their amendments) since 1 January 2025, and writes one CSV row per filing. Save it as sec_filings.py:

import csv
import time
import requests

# The SEC asks scripts to say who they are: put your own name and email here.
HEADERS = {"User-Agent": "Your Name you@example.com"}
TICKERS = ["AAPL", "NVDA", "TSLA", "BRK.B", "JPM"]
FORMS = {"10-K", "10-Q", "8-K"}          # amendments (10-K/A and so on) are kept too
SINCE = "2025-01-01"

# Plain names for the 8-K items you'll see most often (Form 8-K, sec.gov/files/form8-k.pdf).
ITEMS = {"1.01": "Material agreement", "1.02": "Agreement ended", "2.01": "Acquisition or disposal done",
         "2.02": "Results", "2.03": "New debt obligation", "3.02": "Unregistered share sale",
         "3.03": "Change to shareholder rights", "5.02": "Director or officer change",
         "5.03": "Bylaws or fiscal year change", "5.07": "Shareholder vote results",
         "7.01": "Reg FD disclosure", "8.01": "Other events", "9.01": "Exhibits"}


def get(url):
    time.sleep(0.2)                      # at most 5 requests a second; the SEC's limit is 10
    r = requests.get(url, headers=HEADERS, timeout=60)
    r.raise_for_status()
    return r.json()


# 1. Ticker -> CIK, from the SEC's own ticker file. It writes share classes with "-" (BRK-B).
tickers = {v["ticker"]: v["cik_str"] for v in get("https://www.sec.gov/files/company_tickers.json").values()}

rows = []
print(f"{'Ticker':<7}{'CIK':>8}  {'recent block':>12}  {'covers from':<11}  {'pages':>5}  {'10-K':>4} {'10-Q':>4} {'8-K':>4} {'/A':>3}")
for t in TICKERS:
    cik = tickers[t.upper().replace(".", "-")]
    sub = get(f"https://data.sec.gov/submissions/CIK{cik:010d}.json")
    recent = sub["filings"]["recent"]
    blocks = [recent]
    # 2. "recent" holds at least a year or 1,000 filings. Older filings sit in extra pages:
    #    read only the pages that overlap your date window.
    extra = [f for f in sub["filings"]["files"] if f["filingTo"] >= SINCE]
    for f in extra:
        blocks.append(get(f"https://data.sec.gov/submissions/{f['name']}"))
    counts = {"10-K": 0, "10-Q": 0, "8-K": 0, "/A": 0}
    for b in blocks:
        for i, form in enumerate(b["form"]):
            base = form.removesuffix("/A")
            if base not in FORMS or b["filingDate"][i] < SINCE:
                continue
            counts["/A" if form.endswith("/A") else base] += 1
            acc = b["accessionNumber"][i]
            items = [x for x in b["items"][i].split(",") if x]
            rows.append({
                "ticker": t, "cik": cik, "company": sub["name"], "form": form,
                "filed": b["filingDate"][i], "period": b["reportDate"][i],
                "accepted_utc": b["acceptanceDateTime"][i],
                "items": "; ".join(f"{x} {ITEMS.get(x, '')}".strip() for x in items),
                "url": f"https://www.sec.gov/Archives/edgar/data/{cik}/{acc.replace('-', '')}/{b['primaryDocument'][i]}",
            })
    print(f"{t:<7}{cik:>8}  {len(recent['form']):>12,}  {recent['filingDate'][-1]:<11}  {len(extra):>5}  "
          f"{counts['10-K']:>4} {counts['10-Q']:>4} {counts['8-K']:>4} {counts['/A']:>3}")

rows.sort(key=lambda r: r["accepted_utc"], reverse=True)
with open("sec_filings.csv", "w", newline="") as f:
    w = csv.DictWriter(f, fieldnames=list(rows[0]))
    w.writeheader()
    w.writerows(rows)
print(f"\n{len(rows)} filings since {SINCE} written to sec_filings.csv")
Enter fullscreen mode Exit fullscreen mode

Output on 15 November 2026:

Ticker      CIK  recent block  covers from  pages  10-K 10-Q  8-K  /A
AAPL     320193         1,002  2015-10-07       0     2    6   18   1
NVDA    1045810         1,000  2020-09-18       0     2    5   22   0
TSLA    1318605         1,000  2018-06-18       0     2    6   23   2
BRK.B   1067983         1,005  2017-02-14       0     2    6   15   1
JPM       19617        26,439  2025-11-14      10     2    6   47   0

168 filings since 2025-01-01 written to sec_filings.csv
Enter fullscreen mode Exit fullscreen mode

"recent block" is how many filings the submissions file holds directly, "covers from" is the oldest filing date in it, and "pages" is how many older pages the script had to read to reach 1 January 2025. The first rows of sec_filings.csv (URLs cut):

ticker,cik,company,form,filed,period,accepted_utc,items,url
NVDA,1045810,NVIDIA CORP,8-K,2026-11-12,2026-11-11,2026-11-12T13:52:41.000Z,5.02 Director or officer change; 9.01 Exhibits,https://www.sec.gov/...
AAPL,320193,Apple Inc.,8-K,2026-11-09,2026-11-05,2026-11-09T21:30:40.000Z,8.01 Other events; 9.01 Exhibits,https://www.sec.gov/...
BRK.B,1067983,BERKSHIRE HATHAWAY INC,8-K,2026-11-09,2026-11-07,2026-11-09T11:10:14.000Z,2.02 Results; 9.01 Exhibits,https://www.sec.gov/...
BRK.B,1067983,BERKSHIRE HATHAWAY INC,10-Q,2026-11-09,2026-09-30,2026-11-09T11:01:15.000Z,,https://www.sec.gov/...
JPM,19617,JPMORGAN CHASE & CO,10-Q,2026-11-03,2026-09-30,2026-11-03T21:17:12.000Z,,https://www.sec.gov/...
AAPL,320193,Apple Inc.,10-K,2026-11-03,2026-09-26,2026-11-03T13:05:15.000Z,,https://www.sec.gov/...
Enter fullscreen mode Exit fullscreen mode

Why it's built this way:

  • One request for all tickers. The ticker file maps every listed ticker to a CIK, so you don't need a search call per company.
  • The submissions file is columnar. filings.recent is a set of parallel lists (form, filingDate, accessionNumber...), so row i is the same index in each list.
  • Older pages only when needed. The script reads an extra page only if its filingTo date reaches into your window. Apple needed none; JPMorgan needed 10.
  • The document link is built, not scraped. CIK (no leading zeros), accession number without dashes, then primaryDocument.
  • A 0.2-second pause between requests. That's at most 5 a second, half the SEC's limit. The whole run made 16 requests.

What should I check before I trust the CSV?

  1. The "recent" block isn't a fixed time span. The SEC's docs say it holds at least one year of filings or 1,000 filings, whichever is more. For Apple that reached back to 2015. For JPMorgan, 26,439 filings covered only the year from 14 November 2025, and 26 of its 55 rows here (22 8-Ks, 3 10-Qs and a 10-K) were only in the older pages. A script that reads recent alone would have missed them without any error.
  2. Most filings aren't the ones you want. Of Apple's 1,002 recent filings, 149 were 10-K, 10-Q or 8-K; 610 were ownership forms (Forms 3, 4 and 5). JPMorgan's recent block was 22,987 prospectus supplements (424B2) out of 26,439. Filter by form before you do anything else.
  3. Use the ticker the way the SEC writes it. The ticker file has BRK-B, not BRK.B, so the script swaps the dot for a dash. It has 10,404 tickers for 7,997 companies, because share classes such as GOOG and GOOGL point to the same CIK. Look up by ticker, then group by CIK.
  4. Pad the CIK to 10 digits and send a User-Agent. CIK320193.json returned 404; CIK0000320193.json worked. The same request with a generic python-requests User-Agent returned 403.
  5. The filing date isn't always the acceptance date. EDGAR treats most filings sent after 5:30 p.m. Eastern as filed on the next business day (17 CFR 232.13). One NVIDIA 8-K was accepted at 22:35 UTC on 30 June 2025 (6:35 p.m. Eastern) and carries a filing date of 1 July. acceptanceDateTime is in UTC; sort by it if you need the true order.
  6. period means different things. For a 10-Q or 10-K, reportDate is the end of the period covered (Apple's 10-K: 26 September 2026). For an 8-K, it's the date of the event, which can be days before the filing (Apple's 8-K above: event 5 November, filed 9 November).
  7. Amendments come with a /A. The run found 4: two 10-K/As from Tesla and 8-K/As from Apple and Berkshire Hathaway. Keep them if you want the full record, or drop them if you count events.
  8. 8-K items tell you what happened. In the 127 8-K and 8-K/A rows here, the most common items were 9.01 (exhibits, 98), 2.02 (Results of Operations and Financial Condition, 47), 5.02 and 8.01 (27 each). Item 2.02 is Results of Operations and Financial Condition, which companies commonly use for earnings releases; filter on 2.02 rather than reading every 8-K.

To change the list, edit TICKERS, FORMS and SINCE.

The hosted version (Disclosure: we built this)

We built an Apify Actor, SEC EDGAR Filings API: Form D, 8-K & XBRL (Unofficial), that does this as its "Filings by company" mode. Give it up to 200 tickers or CIKs (BRK-B and BRK.B both work) and the form types you want. It reads the same submissions files, goes back through the older pages when your date window needs them, and returns one row per filing, newest first, with the 8-K item numbers and links to the filing index and main document. It never returns Forms 3, 4, 5 or 144 or Schedules 13D and 13G, which are mostly filed by individuals, and requests are paced to at most 5 a second with a declared User-Agent. Unknown tickers get a free not_found row. It has other modes too (latest filings across all companies, Form D, full-text search and XBRL financials), and a monitor mode that returns only filings it hasn't returned before. It's pay per event, charged per filing row returned; the prices are on the Actor's Pricing tab. For example (not run for this post):

{
  "mode": "companyFilings",
  "companies": ["AAPL", "NVDA", "TSLA", "BRK.B", "JPM"],
  "formTypes": ["10-K", "10-Q", "8-K"],
  "filedSince": "2025-01-01",
  "maxResults": 0
}
Enter fullscreen mode Exit fullscreen mode

SEC EDGAR Filings API on Apify

Data: SEC EDGAR (data.sec.gov and sec.gov), read 15 November 2026. Filings are as submitted by the companies; the SEC does not check them for accuracy. This post and the Actor are not affiliated with or endorsed by the U.S. Securities and Exchange Commission. Nothing here is investment advice.

Your Evenings

Top comments (0)