How to Scrape SEC EDGAR Data: Complete Guide for 2026
Tutorials

How to Scrape SEC EDGAR Data: Complete Guide for 2026

Learn how to scrape SEC EDGAR for public financial data using AlterLab's API with Python and Node.js. Covers anti-bot handling, structured extraction, and cost-effective scaling.

3 min read
2 views

AlterLab handles this automaticallyscrape any URL with one API call. No infrastructure required.

Try it free

This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

TL;DR

To scrape SEC EDGAR: Use AlterLab's API with Python or Node.js, start at T1 tier, let auto-escalation handle anti-bot protections, extract structured data via CSS selectors or Cortex AI, and respect rate limits. Typical cost is $0.002/request after initial attempts.

Why collect government data from SEC EDGAR?

SEC EDGAR hosts filings for all public U.S. companies. Practical uses include:

  • Monitoring 10-K/10-Q filings for competitive intelligence on supply chain changes
  • Tracking insider trading patterns (Form 4) to inform investment strategies
  • Aggregating bankruptcy filings (Chapter 11) for distressed asset opportunities

Technical challenges

Government sites like sec.gov implement standard anti-bot protections: rate limiting by IP, User-Agent header validation, and occasional JavaScript challenges. Raw HTTP requests often fail with 403/429 responses. AlterLab's Smart Rendering API handles these via automatic proxy rotation, realistic browser fingerprints, and tier escalation—ensuring compliant access to public pages without bypassing security measures.

Quick start with AlterLab API

See the Getting started guide for setup. Here's how to scrape a sample SEC EDGAR page:

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")
response = client.scrape("https://www.sec.gov/Archives/edgar/data/320193/000032019323000108/tsla-20231231.htm")
print(response.text[:500])  # Preview first 500 chars
JAVASCRIPT
import { AlterLab } from "alterlab";

const client = new AlterLab({ apiKey: "YOUR_API_KEY" });
const response = await client.scrape("https://www.sec.gov/Archives/edgar/data/320193/000032019323000108/tsla-20231231.htm");
console.log(response.text.substring(0, 500));
Bash
curl -X POST https://api.alterlab.io/v1/scrape \
  -H "X-API-Key: YOUR_KEY" \
  -d '{"url": "https://www.sec.gov/Archives/edgar/data/320193/000032019323000108/tsla-20231231.htm"}'

Extracting structured data

SEC EDGAR filing pages contain predictable patterns. For the Tesla 10-K example above:

  • Company name: <span class="companyName">Tesla Inc</span>
  • Filing date: <div class="filingDate">2023-12-31</div>
  • Document type: <input name="formType" value="10-K">

Extract with CSS selectors:

Python
import alterlab
from parsel import Selector

client = alterlab.Client("YOUR_API_KEY")
html = client.scrape("https://www.sec.gov/Archives/edgar/data/320193/000032019323000108/tsla-20231231.htm").text
selector = Selector(text=html)

data = {
    "company": selector.css(".companyName::text").get(),
    "date": selector.css(".filingDate::text").get(),
    "form_type": selector.css('input[name="formType"]::attr(value)').get()
}
print(data)

Structured JSON extraction with Cortex

For complex filings, use AlterLab's Cortex AI to extract typed JSON without CSS selectors:

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")
result = client.extract(
    url="https://www.sec.gov/Archives/edgar/data/320193/000032019323000108/tsla-20231231.htm",
    schema={
        "type": "object",
        "properties": {
            "company_name": {"type": "string"},
            "filing_date": {"type": "string", "format": "date"},
            "total_assets": {"type": "number"},
            "revenue": {"type": "number"},
            "risk_factors": {"type": "array", "items": {"type": "string"}}
        }
    }
)
print(result.data)  # Typed JSON output

Cost breakdown

AlterLab's pricing adapts to page complexity. For SEC EDGAR:

  • Most pages succeed at T3 (Stealth tier) after initial T1/T2 attempts
  • You only pay for the tier that successfully retrieves the page
TierUse CaseCost per RequestCost per 1,000Requests per $1
T1 — CurlStatic HTML, no JS needed$0.0002$0.205,000
T2 — HTTPStandard pages with headers$0.0003$0.303,333
T3 — StealthProtected pages, anti-bot active$0.002$2.00500
T4 — BrowserFull JS rendering required$0.004$4.00250
T5 — CAPTCHACAPTCHA solving + JS rendering$0.02$20.0050

View full pricing. Note: AlterLab auto-escalates tiers — start at T1 and the API promotes automatically if a lower tier fails. You only pay for the tier that succeeds.

99.2%Success Rate
1.2sAvg Response
$0.002Per Request (T3)

Best practices

  • Rate limiting: SEC EDGAR allows 10 requests/second per IP. AlterLab distributes requests across its proxy pool; add delay: 100ms between bursts if scraping aggressively.
  • robots.txt: Check https://www.sec.gov/robots.txt—scraping /Archives/edgar/ is permitted with crawl-delay=10 seconds.
  • Headers: AlterLab sends realistic browser headers by default. Override only if necessary (e.g., custom
Share

Was this article helpful?

Frequently Asked Questions

Scraping publicly accessible SEC EDGAR data is generally permissible under laws like hiQ v LinkedIn for public data, but you must review sec.gov's robots.txt and Terms of Service, implement rate limiting, and avoid scraping non-public information. Always ensure compliance.
SEC EDGAR employs standard anti-bot measures including rate limiting, header checks, and occasional JavaScript challenges. AlterLab's Smart Rendering API automatically handles these via proxy rotation, header management, and tier escalation to ensure reliable access to public pages.
Costs start at $0.0002 per request for static content (T1) and scale to $0.004 for full browser rendering (T4). AlterLab auto-escalates tiers — you only pay for the successful tier. For typical SEC EDGAR pages, T3 ($0.002/request) is often sufficient after initial attempts.