SEC EDGAR Scraper: Filings & Financials (Tested)
A tested SEC EDGAR scraper guide - declare one User-Agent, then pull filings, XBRL financials and full-text search keyless. Live commands, real outputs.

On this page
The SEC publishes every public-company filing it has and asks for exactly one thing in return: tell them who you are. Skip that and the server answers with a 403 page titled “Your Request Originates from an Undeclared Automated Tool”. I built and ran a sec edgar scraper against the live endpoints on October 29, 2026, from a home connection, and the declaration turned out to be the entire difficulty. Everything behind it is keyless JSON: the filing index, the XBRL financials, full-text search across two decades of filings.
This guide covers the declaration rule, the six doors into EDGAR and when to use each, working commands with the outputs I actually got, and one tool combination that silently fails here. The data is US government work product, free to use; the SEC’s access policy asks for the declared user agent and a maximum of 10 requests per second. None of this is legal advice, and Is Web Scraping Legal? has the general version.
The one rule every SEC EDGAR scraper must follow
EDGAR’s gate is not a bot detector. It is a name tag reader. I sent four different request identities at the same endpoint to prove it:
| Request identity | Result on data.sec.gov |
|---|---|
curl’s default (curl/8.x) |
403, “undeclared automated tool” page |
| Empty User-Agent header | 403 |
| Full Chrome fingerprint (headers, TLS) | 200, JSON served |
Motherlode Lab [email protected] |
200, JSON served |
A Chrome impersonation sails through undeclared. I report that because you will see tools that “work” on EDGAR this way, but I do not recommend building on it: the declaration costs one header, it is the SEC’s stated rule, and their developer resources page asks for company name plus contact email. Something like -A "Acme Research [email protected]" satisfies it. You are identifying yourself to a government agency that publishes the data for free; pretending to be Chrome is both pointless and rude.
The rate limit comes from the SEC’s own error page, which I have verbatim: “Current guidelines limit users to a total of no more than 10 requests per second, regardless of the number of machines used to submit requests.” Exceed it and your IP gets limited until it has stayed under 10 requests per second for 10 minutes. My test ran at 2-second intervals and never saw a rate response.
One trap to know before anything else: the 403 page is a full, well-formed HTML document, so scrapers that do not check status codes treat it as a successful scrape. My first Magpie run with the default user agent returned the error page as clean markdown and exited 0. Guard any pipeline with a parse check:
magpie scrape "https://data.sec.gov/submissions/CIK0000320193.json" \
--header "User-Agent: Acme Research [email protected]" --page-format raw \
| jq -e '.cik'
# prints 0000320193 and exits 0; a non-zero exit means HTML came back, i.e. you are undeclared
Six doors into EDGAR, and which to open first
| Door | What you get | Key? | My test (2026-10-29) |
|---|---|---|---|
www.sec.gov/files/company_tickers.json |
Ticker → CIK map, 10,430 rows | No | 798,077 bytes, NVDA found in one jq |
data.sec.gov/submissions/CIK*.json |
Every recent filing per company | No | Apple: 1,002 recent filings, 163,917 bytes |
data.sec.gov/api/xbrl/companyconcept/... |
One financial concept, tagged history | No | FY2025 Apple revenue in an 18 KB call |
data.sec.gov/api/xbrl/companyfacts/CIK*.json |
Every XBRL concept for a company | No | 3.8 MB for Apple, 503 us-gaap concepts |
efts.sec.gov/LATEST/search-index |
Full-text search, filings since 2001 | No | 2,294 hits for “tariff” in 2026 10-Ks |
www.sec.gov/Archives/edgar/data/... |
The filing documents themselves | No | 10-K HTML fetched, converted to markdown and clean HTML |
Same host rule everywhere: efts.sec.gov and www.sec.gov refuse undeclared tools exactly like data.sec.gov does. data.sec.gov ships no robots.txt file at all; www.sec.gov allows the /Archives/edgar/data/ paths and disallows /cgi-bin, which is where the old browse-edgar HTML pages live. The JSON APIs are the documented, crawler-welcome route anyway, so I treat browse-edgar as a human fallback and nothing more.
Start with the CIK: the ticker map
Every EDGAR dataset addresses companies by CIK, a 10-digit number, not by ticker. The map is one file:
curl -s -A "Acme Research [email protected]" \
"https://www.sec.gov/files/company_tickers.json" \
| jq -r '.[] | select(.ticker=="NVDA") | "\(.ticker) -> CIK \(.cik_str) (\(.title))"'
NVDA -> CIK 1045810 (NVIDIA CORP)
10,430 tickers in 798 KB. Cache this file; it changes only when companies register.
If you route fetches through Magpie, pass JSON endpoints through with --page-format raw, which returns the response body byte for byte. My Magpie fetch of the Apple submissions file produced exactly the same 163,917 bytes curl did.
The filing index: one JSON holds a company’s recent history
data.sec.gov/submissions/CIK{10-digit}.json returns metadata (name, SIC, tickers, exchanges) plus filings.recent: parallel arrays describing the 1,002 most recent filings, including accessionNumber, form, filingDate, reportDate, primaryDocument, and 12 more fields each. Apple’s payload also carries filings.files, a pointer to overflow files for anything older than what recent holds (Apple’s covers 1994 to 2015 in one file).
The parallel-arrays layout looks odd until you transpose it once. Fetch it once, then:
curl -s -A "Acme Research [email protected]" -o apple.json \
"https://data.sec.gov/submissions/CIK0000320193.json"
jq -r '.filings.recent |
[.accessionNumber, .form, .filingDate, .primaryDocument] |
transpose[] | @tsv' apple.json | grep -P "\t10-K\t" | head -3
0000320193-25-000079 10-K 2025-10-31 aapl-20250927.htm
0000320193-24-000123 10-K 2024-11-01 aapl-20240928.htm
0000320193-23-000106 10-K 2023-11-03 aapl-20230930.htm
An accession number is the address of a filing. Strip the dashes, insert it between the CIK and the document name, and you have the permanent archive URL, which is the pattern the full-text search section builds on.
Financial statements: skip the filing HTML, read the XBRL
Here is the opinion that saves the most time in this whole guide: never parse financial numbers out of filing documents. Every since-2009 filing tags its numbers in XBRL, and the SEC exposes the tags through two keyless endpoints.
companyconcept returns one metric with its full tagged history:
curl -s -A "Acme Research [email protected]" \
"https://data.sec.gov/api/xbrl/companyconcept/CIK0000320193/us-gaap/RevenueFromContractWithCustomerExcludingAssessedTax.json" \
| jq -r '[.units.USD[] | select(.form=="10-K" and .fp=="FY")][-1] |
"\(.start) -> \(.end): \(.val)"'
2024-09-29 -> 2025-09-27: 416161000000
That is Apple’s FY2025 revenue, $416.161 billion, pulled from an 18 KB response, no table parsing, no PDF. The concept name is the fussy part: revenue alone has several tags (Revenues, RevenueFromContractWithCustomerExcludingAssessedTax), and companies pick different ones. When you do not know the tag, companyfacts returns all of them at once, 3.8 MB and 503 us-gaap concepts for Apple. Download it once per company and filter locally.
This route is why an SEC EDGAR scraper needs no extraction magic: the numbers arrive pre-structured, with the form, fiscal period, and filing that sourced each value attached. Compare that with the same numbers inside a filing document in the next section.
Full-text search across every filing since 2001
The least-known door: EDGAR indexes the text of every filing document since 2001, and the search backend answers plain JSON at efts.sec.gov/LATEST/search-index. Parameters: q (quoted phrase or terms), forms (comma-separated form types), and dateRange=custom with startdt/enddt (YYYY-MM-DD).
curl -s -A "Acme Research [email protected]" \
"https://efts.sec.gov/LATEST/search-index?q=%22tariff%22&forms=10-K&dateRange=custom&startdt=2026-01-01&enddt=2026-10-29" \
| jq '.hits.total'
{"value": 2294, "relation": "eq"}
Exactly 2,294 10-K filings mentioned tariffs in 2026 through October 29. Search results are Elasticsearch envelopes; each hit carries _source fields worth knowing: adsh (the accession number), ciks, display_names (“Apple Inc. (AAPL) (CIK 0000320193)” style), file_type, file_date, period_ending, and file_description. The _id is accession:filename, which converts directly to a document URL:
curl -s -A "Acme Research [email protected]" \
"https://efts.sec.gov/LATEST/search-index?q=%22tariff%22&forms=10-K&dateRange=custom&startdt=2026-01-01&enddt=2026-10-29" \
| jq -r '.hits.hits[0] |
.["_source"].ciks[0] as $cik | .["_id"] as $id | ($id | split(":")) as $parts |
"https://www.sec.gov/Archives/edgar/data/\($cik | gsub("^0+";""))/\($parts[0] | gsub("-";""))/\($parts[1])"'
https://www.sec.gov/Archives/edgar/data/1994341/000110465926036939/tm261242d1_ex33-1.htm
I fetched the URL that pipeline printed during testing: 200, a 50,054-byte exhibit filed with a 2026 10-K. Note the gsub("^0+";""), the CIK needs its leading zeros stripped; my first version stripped only one zero and the lesson is in this sentence so you skip it. Two caps to plan around: totals above 10,000 report "relation": "gte" (page with date ranges to narrow), and the search covers 2001 onward only.
For monitoring runs of this pipeline, Magpie’s watch mode is the usual next thought. On EDGAR it is the wrong one, as the section below explains.
The filing document: markdown for prose, HTML format for tables
Eventually you want the document itself. Apple’s FY2025 10-K (aapl-20250927.htm, filed 2025-10-31) is 1,520,320 bytes of inline-XBRL HTML. A static fetch converts fine:
magpie scrape "https://www.sec.gov/Archives/edgar/data/320193/000032019325000079/aapl-20250927.htm" \
--header "User-Agent: Acme Research [email protected]" --out 10k.json
The result: 4,385 words of clean markdown covering the business description, risk factors, and MD&A, extracted in 2.8 seconds. But grep it for “Total net sales” and you get nothing. The income statement, balance sheet, and cash flow statement live in HTML tables, and the markdown cleaner drops them along with the navigation chrome. The same URL with --page-format html returns 1.47 MB of cleaned HTML with every table intact.
So the split is: XBRL endpoints for numbers, markdown for narrative sections, html format only when a table exists nowhere in XBRL (some exhibits and supplemental tables qualify). Parsing statements out of iXBRL markup is a weekend I have watched people lose; the API call above replaces it with one jq filter.
Why watch mode fails on EDGAR (and what to run instead)
Plain statement of a limit: magpie watch takes no --header flag, so it cannot declare a user agent. It fetches with the default identity, receives the undeclared-tool page, and then the fun starts. That error page contains a per-request reference ID, so every check hashes a different page:
changed=true old=f396ee28... new=859608f6...
- 0.f2d613a.1793256642.bb4f363
+ 0.f2d613a.1793256669.bb519ee
Watch reports a change on every run forever, and the diff is noise. The fix is a cron job doing its own comparison: scrape the submissions JSON with --as (below) once an hour, compare jq '.filings.recent.filingDate[0]' against last hour’s value, alert on difference. Fewer moving parts than watch anyway, and it respects the 10-requests-per-second ceiling trivially.
Make the declaration permanent
Typing the user agent onto every command is how it gets forgotten. Magpie stores header profiles:
magpie profile save sec --header "User-Agent: Acme Research [email protected]"
magpie scrape "https://data.sec.gov/submissions/CIK0000320193.json" --as sec
One profile, every future command inherits the declaration. The rest of a sensible pipeline is jq and a scheduler; if you want the JSON landing in spreadsheets instead, scrape website to CSV or JSON covers the conversion, and web scraping headers covers the request-level details around that User-Agent line.
Where Magpie fits and does not, stated plainly: it ran every route in this guide, one binary, no plugins, and --page-format raw gives you JSON bytes identical to curl’s. It has no finance vertical (its 27 extractors cover Reddit, GitHub, YouTube and friends), which costs nothing here because EDGAR ships its own structured data. Watch mode does not work on EDGAR, as shown above. If your job is market prices rather than filings, that is the Yahoo Finance scraper test, different doors entirely.
FAQ
Does SEC EDGAR have an API?
Yes, several, all keyless: data.sec.gov serves submissions and XBRL company data, efts.sec.gov/LATEST/search-index serves full-text search, and www.sec.gov/Archives/ serves the documents. No signup exists. The only requirement is a User-Agent header identifying your organization with a contact email.
What is the EDGAR rate limit? 10 requests per second per IP, total, regardless of how many machines or threads you spread the load across. Exceed it and the block lasts until your traffic has stayed under the threshold for 10 minutes. The SEC states this in its developer resources and on the error page itself.
Is scraping SEC EDGAR legal? The filings are public records and US government works, and the SEC publishes APIs for programmatic access, which makes this about the most sanctioned scraping there is. You must follow the declared-user-agent policy and rate limits, and specific uses (redistribution, trading) carry their own rules. Not legal advice; see the legal explainer.
How do I find a company’s CIK number?
Fetch https://www.sec.gov/files/company_tickers.json and search it: 10,430 ticker-to-CIK rows in one 798 KB file. The full-text search hits also carry CIKs in their ciks field, and the browse-edgar company page shows it in the URL.
Can I get financial data without parsing filing HTML?
Yes, and you should. data.sec.gov/api/xbrl/companyconcept/CIK.../us-gaap/{Tag}.json returns one metric with its full tagged history, and companyfacts returns every XBRL concept a company reports. The numbers arrive typed, with form, fiscal period, and source filing attached.


