All Posts
TutorialSEC EDGAR APIPythondata.sec.gov

SEC EDGAR API in Python: Endpoints and Limits

How to use the SEC EDGAR API in Python: the four data.sec.gov endpoints, ticker to CIK, User-Agent and rate limits, and the traps in company facts.

Published December 1, 202611 min readAndy Reimann
SEC EDGAR API in Python: Endpoints and Limits

The SEC EDGAR API is free, needs no API key, and serves every public company's filing history and XBRL financial facts as JSON from data.sec.gov. Four endpoints cover most needs: submissions, companyfacts, companyconcept and frames. Two rules apply to every request: a User-Agent header that names you, and no more than 10 requests per second.

This tutorial shows how to use the SEC EDGAR API in Python, from a ticker to a CIK, to a company's full filing history, to its financial data. Every snippet below was run against the live API on December 1, 2026, and the outputs are pasted as they came back, Apple included. Along the way you will hit the limits that catch most developers: a 403 with no explanation, a filing list that silently stops in 2015, and a "Q4 2025" frame where one in nine companies reports a different date.

The four SEC EDGAR API endpoints

SEC documents its REST endpoints on the EDGAR Application Programming Interfaces page. All four take the company's Central Index Key (CIK), except frames, which works across companies.

EndpointURL patternReturns
Submissions/submissions/CIK##########.jsonCompany name, tickers, fiscal year end and filing history
Company facts/api/xbrl/companyfacts/CIK##########.jsonEvery XBRL fact the company reported under a standard taxonomy
Company concept/api/xbrl/companyconcept/CIK##########/us-gaap/Assets.jsonOne concept's full history for one company
Frames/api/xbrl/frames/us-gaap/Assets/USD/CY2025Q4I.jsonOne concept, unit and calendar period across all companies

A few facts about the service that shape how you use it:

  • No API key, no account. The endpoints are open. The SEC also has filer API tokens, but those are for submitting filings, not reading them.
  • Fast updates. SEC says the submissions API typically updates in under a second after a filing is accepted and the XBRL APIs in under a minute, with longer delays possible at peak filing times.
  • Bulk files for bulk work. submissions.zip and companyfacts.zip are recompiled nightly. For more than a few hundred companies, one download beats thousands of requests.
  • No CORS. SEC states that data.sec.gov does not support cross-origin requests, so a browser fetch from your web app is blocked. Call it from a server or a script.
  • No search. EDGAR full-text search is a separate web tool, not part of the documented APIs. The endpoints answer "what did this company file", not "which filings mention this phrase".

User-Agent and rate limits: a client that stays welcome

SEC's Accessing EDGAR Data page sets the fair access rules. Declare a User-Agent in the form Sample Company Name AdminContact@example.com, ask for gzip with Accept-Encoding: gzip, deflate, and keep to the current maximum of 10 requests per second, counted across every machine you use. Exceed it and SEC may limit further requests from your IP address for a brief period.

The User-Agent rule is enforced. The same URL with and without one:

bash
$ curl -s -o /dev/null -w "%{http_code}" https://data.sec.gov/submissions/CIK0000320193.json
403
$ curl -s -o /dev/null -w "%{http_code}" -A "Sample Company admin@example.com" \
    https://data.sec.gov/submissions/CIK0000320193.json
200
$ curl -s -o /dev/null -w "%{http_code}" -A "Sample Company admin@example.com" \
    https://data.sec.gov/submissions/CIK320193.json
404

A bare 403 with no body that explains it is the most common first-hour failure with the SEC EDGAR API. The third request shows the second: data.sec.gov paths need the CIK padded to 10 digits, and the unpadded one is a 404. Every snippet in this tutorial goes through one small client that sets the headers, spaces requests at 8 per second and backs off on 403 or 429:

python
import time

import requests

USER_AGENT = "Sample Company admin@example.com"
MIN_INTERVAL = 0.125  # 8 requests per second, under SEC's 10

session = requests.Session()
session.headers.update({"User-Agent": USER_AGENT, "Accept-Encoding": "gzip, deflate"})
_last_request = 0.0


def get_json(url, retries=4):
    global _last_request
    for attempt in range(retries):
        wait = MIN_INTERVAL - (time.monotonic() - _last_request)
        if wait > 0:
            time.sleep(wait)
        _last_request = time.monotonic()
        resp = session.get(url, timeout=30)
        if resp.status_code in (403, 429) and attempt < retries - 1:
            time.sleep(2 ** attempt * 5)
            continue
        resp.raise_for_status()
        return resp.json()

Use your own company name and a real contact address. SEC cannot help you debug a scraper, but it can reach you before it blocks one.

From ticker to CIK with company_tickers.json

Every company-specific endpoint is keyed by CIK, not by ticker. SEC publishes the mapping at https://www.sec.gov/files/company_tickers.json. On December 1, 2026 it held 10,358 rows, keyed by row number rather than by ticker:

json
{
  "0": {"cik_str": 320193, "ticker": "AAPL", "title": "Apple Inc."},
  ...
}

So you loop over the values, match the ticker, and pad cik_str to 10 digits with leading zeros:

python
def ticker_to_cik(ticker):
    rows = get_json("https://www.sec.gov/files/company_tickers.json")
    for row in rows.values():
        if row["ticker"] == ticker.upper():
            return str(row["cik_str"]).zfill(10)
    raise KeyError(f"{ticker} not in company_tickers.json")


cik = ticker_to_cik("AAPL")
print(cik)  # 0000320193

Keep the CIK as your durable key, not the ticker. Tickers get changed and later reused by unrelated companies, and company_tickers.json only knows today's mapping. Our post on ticker symbol change history covers why that breaks historical joins.

Filing history with the submissions API

The submissions endpoint returns the company's profile and its filings as parallel arrays: index i of form, filingDate, reportDate, accessionNumber and primaryDocument all describe the same filing.

python
sub = get_json(f"https://data.sec.gov/submissions/CIK{cik}.json")
recent = sub["filings"]["recent"]
print(sub["name"], sub["fiscalYearEnd"], len(recent["form"]))
print(sub["filings"]["files"])
text
Apple Inc. 0925 1000
[{'name': 'CIK0000320193-submissions-001.json', 'filingCount': 1287,
  'filingFrom': '1994-01-26', 'filingTo': '2015-10-17'}]

Recent filings stop at 1,000

filings.recent holds at least one year of filings or the 1,000 most recent, whichever is more. Apple's holds exactly 1,000, reaching back only to October 19, 2015. The other 1,287 filings, back to 1994, are in an extra file listed under filings.files. Code that reads only recent silently loses a decade for any active filer. Merge them:

python
def all_filings(sub):
    batches = [sub["filings"]["recent"]]
    for extra in sub["filings"]["files"]:
        batches.append(get_json(f"https://data.sec.gov/submissions/{extra['name']}"))
    for batch in batches:
        for i in range(len(batch["accessionNumber"])):
            yield {key: batch[key][i] for key in
                   ("form", "filingDate", "reportDate", "accessionNumber", "primaryDocument")}


filings = list(all_filings(sub))
print(len(filings), filings[-1]["filingDate"])  # 2287 1994-01-26

Filter by form type, carefully

Of Apple's 1,000 recent filings, 591 are Form 4 insider reports, 102 are 8-Ks and 33 are 10-Qs. The annual reports are a small minority, and they come in more than one form type:

python
from collections import Counter

annual = [f for f in filings if f["form"].startswith("10-K")]
print(Counter(f["form"] for f in annual))
for f in annual[:3]:
    print(f["form"], f["filingDate"], f["reportDate"], f["accessionNumber"], f["primaryDocument"])
text
Counter({'10-K': 31, '10-K/A': 2, '10-K405': 2})
10-K 2026-11-03 2026-09-26 0000320193-26-000026 aapl-20260926.htm
10-K 2025-10-31 2025-09-27 0000320193-25-000079 aapl-20250927.htm
10-K 2024-11-01 2024-09-28 0000320193-24-000123 aapl-20240928.htm

An exact match on "10-K" drops the two amendments and Apple's 10-K405 filings from 1998 and 2001, an annual report variant that was used until the early 2000s. Decide which variants you want on purpose. Our SEC forms field guide explains what each form type contains.

Building a document URL from an accession number

Filing documents live under /Archives/edgar/data/ with the unpadded CIK and the accession number without hyphens:

python
def document_url(cik, filing):
    folder = filing["accessionNumber"].replace("-", "")
    return f"https://www.sec.gov/Archives/edgar/data/{int(cik)}/{folder}/{filing['primaryDocument']}"


print(document_url(cik, annual[2]))
# https://www.sec.gov/Archives/edgar/data/320193/000032019324000123/aapl-20240928.htm

Build URLs from the accession number in the data, never from a filename that looks right. Apple's fiscal 2023 10-K is aapl-20230930.htm under accession 0000320193-23-000106. Put the same filename under 0000320193-23-000077, which is Apple's 10-Q for the quarter ended July 1, 2023, and SEC returns 404.

Financial facts: companyfacts, companyconcept and frames

The three XBRL endpoints serve the tagged numbers inside 10-Ks, 10-Qs and other filings. Apple's companyfacts response holds 512 us-gaap concepts, 2 dei concepts and 6 ffd concepts, each with every value reported for it. When you already know the concept, companyconcept returns just that one:

python
concept = get_json(f"https://data.sec.gov/api/xbrl/companyconcept/CIK{cik}/us-gaap/Assets.json")
latest = max(concept["units"]["USD"], key=lambda f: (f["end"], f["filed"]))
print(latest)
text
{'end': '2026-09-26', 'val': 404548000000, 'accn': '0000320193-26-000026', 'fy': 2026,
 'fp': 'FY', 'form': '10-K', 'filed': '2026-11-03', 'frame': 'CY2026Q3I'}

Each row carries the accession number (accn), form and filing date, so any value can be traced back to its filing. Ask for a concept the company never used, such as SalesRevenueGoodsNet for Apple, and the endpoint answers 404 rather than an empty list. Treat a 404 there as "try the next candidate concept", not as an error.

Frames: one concept across every company

Frames returns one value per company for a concept, unit and calendar period. Periods are written CY2025 for a year, CY2025Q4 for a quarter and CY2025Q4I for an instant such as a balance sheet date. SEC picks, for each company, the last-filed fact that most closely fits the requested calendar period. That fit is looser than the label suggests:

python
frame = get_json("https://data.sec.gov/api/xbrl/frames/us-gaap/Assets/USD/CY2025Q4I.json")
print(frame["ccp"], len(frame["data"]))

ends = Counter(row["end"] for row in frame["data"])
print(ends.most_common(4))
print([r for r in frame["data"] if r["cik"] == int(cik)])
text
CY2025Q4I 6242
[('2025-12-31', 5572), ('2026-01-31', 253), ('2025-11-30', 138), ('2025-12-27', 73)]
[{'accn': '0000320193-26-000006', 'cik': 320193, 'entityName': 'Apple Inc.',
  'loc': 'US-CA', 'end': '2025-12-27', 'val': 379297000000}]

Of 6,242 companies in the "end of 2025" total assets frame, 670 report a different date: January 31, 2026 for 253 of them, November 30, 2025 for 138, and December 27, 2025 for Apple and 72 others. Apple's value comes from a 10-Q for its fiscal first quarter, not from its annual report. The same mismatch shows in companyconcept above, where Apple's fiscal year-end balance is framed as CY2026Q3I. Frames is excellent for screening; for comparisons that must line up on fiscal periods, check end on every row.

Two more quirks. The submissions profile says fiscalYearEnd: "0925", but Apple's year runs 52 or 53 weeks and its fiscal 2026 ended on September 26. Use each filing's reportDate, not the profile. And companyfacts is filing-centric, not a clean time series: the same period repeats in later filings, restatements sit next to originals, and the concept for a line item can change from year to year. Our explainer on XBRL financial data walks through all three with Apple's revenue, which sits under three different concepts between 2007 and 2026. SEC's XBRL APIs also leave out company-specific extension concepts and dimensional facts such as segment revenue, which exist only in the filing itself.

Getting financial data from SEC EDGAR: raw or normalized

The SEC EDGAR API is the free, authoritative source, and for a handful of companies and a few concepts it is all you need. (For the vendor alternatives that are also free, see our comparison of each free API for SEC financial statements.) The work grows with scope. A financial statement for thousands of companies means choosing among dozens of candidate concepts per line item, deduplicating comparatives, deciding between original and restated values, deriving the fourth quarter (no 10-Q covers it, see how to calculate Q4 earnings), and keeping all of it current.

SEC EDGAR APIStockFit API
Cost and accessFree, no key, 10 requests per secondFree plan with an API key; paid plans for longer history and commercial use
IdentifierCIK onlyTicker, CIK, CUSIP or FIGI
Financial statementsRaw facts per concept; you build the statementsIncome statement, balance sheet and cash flow on standard line items
RestatementsAll versions side by side; you chooseLatest value served, prior value kept with its filing
Browser useNo CORSServer-side key; MCP server for AI tools
Audit trailAccession number on each factAccession number on each value, plus the XBRL concept on request

StockFit reads the same filings from SEC EDGAR and keeps their receipts. The ticker step is one call to /api/lookup/symbol, which also returns former names:

bash
curl -H "Authorization: Bearer $STOCKFIT_API_KEY" \
  "https://api.stockfit.io/v1/api/lookup/symbol?symbol=AAPL"
json
{
  "symbols": ["AAPL"],
  "exchanges": ["Nasdaq"],
  "name": "Apple Inc.",
  "cik": 320193,
  "formerNames": ["APPLE INC", "APPLE COMPUTER INC", "APPLE COMPUTER INC/ FA"],
  "status": "operating",
  "priorTickers": []
}

/api/filings lists filings by ticker and form type, with the same accession numbers and document URLs you built by hand above, plus the exact acceptance time and an amendment flag (trimmed to the first result):

json
{
  "page": 1,
  "pageSize": 3,
  "data": [
    {
      "type": "10-K",
      "accessionNumber": "0000320193-26-000026",
      "url": "https://www.sec.gov/Archives/edgar/data/320193/000032019326000026/aapl-20260926.htm",
      "dateFiled": "2026-11-03",
      "acceptedAt": "2026-11-03T13:05:15Z",
      "xbrl": true,
      "amendment": false,
      "periodEndDate": "2026-09-26"
    },
    ...
  ]
}

And /api/financials/income-statement returns the statement itself, each value keyed by the accession number it came from, with the XBRL concept when you pass includeSourceDetails=true. For how StockFit compares with other SEC data vendors, see StockFit vs sec-api.io, the wider list of sec-api.io alternatives and our comparison of fundamentals APIs.

A good habit either way: when a number matters, open its accession on EDGAR and check it against the filing. The lookup, filings and income statement endpoints are on the Free plan, which returns the latest year of statements (10 years on Starter, the full history on Stock and Pro). and run Apple both ways.

FAQ

Q.Does the SEC EDGAR API require an API key?
No. The data.sec.gov endpoints (submissions, companyfacts, companyconcept and frames) are free and need no key or account. Every automated request must still send a User-Agent header that names your company and a contact email, or SEC answers 403.
Q.What is the SEC EDGAR API rate limit?
SEC's fair access policy sets a maximum of 10 requests per second, counted across all the machines you use. If you exceed it, SEC may limit further requests from your IP address for a brief period. Throttle below the limit, cache responses, and use the nightly bulk ZIP files for large pulls.
Q.Why does the SEC API return 403?
Most often because the request has no declared User-Agent. A request with curl's default User-Agent returned 403 in our test, and the same request with "Company Name contact@example.com" returned 200. Sustained traffic above the rate limit can also get an IP address blocked for a while.
Q.How do I convert a ticker to a CIK?
Download https://www.sec.gov/files/company_tickers.json, which lists ticker, cik_str and title for each company, keyed by row number rather than by ticker. Loop over the values, match the ticker, and pad cik_str to 10 digits with leading zeros for data.sec.gov paths (320193 becomes 0000320193). Archive URLs use the unpadded number.
Q.Why doesn't the submissions API return all filings?
filings.recent holds at least one year of filings or the 1,000 most recent, whichever is more. Older filings sit in extra JSON files listed under filings.files. For Apple, recent covers 1,000 filings back to October 2015, and CIK0000320193-submissions-001.json holds 1,287 more back to 1994.
Q.Can I call the SEC EDGAR API from JavaScript in the browser?
Not directly. SEC states that data.sec.gov does not support Cross Origin Resource Sharing (CORS), so browser fetch calls are blocked. Call it from a server, a script or a serverless function and pass the result to the front end.
Q.How quickly does the SEC API update after a filing?
SEC says the submissions API is updated with a typical processing delay of under a second and the XBRL APIs in under a minute, with longer delays possible at peak filing times. The bulk companyfacts.zip and submissions.zip archives are recompiled nightly.
Q.Does the SEC EDGAR API return financial statements?
Not as statements. companyfacts returns every standard-taxonomy XBRL fact a company reported, but you assemble the income statement, balance sheet and cash flow yourself: pick the concepts, deduplicate comparatives, handle restatements and derive Q4. Normalized APIs such as StockFit return finished statements with the accession number of each value.

Ready to build?

Free API key, no credit card.