```yaml
product: AlterLab
title: How to Scrape SEC EDGAR Data: Complete Guide for 2026
category: Tutorials
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
last_updated: 2026-07-17
canonical_facts:
  - "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."
source_url: https://alterlab.io/blog/how-to-scrape-sec-edgar-data-complete-guide-for-2026
```

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

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](/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](/docs/quickstart/installation) for setup. Here's how to scrape a sample SEC EDGAR page:

```python title="scrape_sec-gov.py" {3-5}
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 title="scrape_sec-gov.js" {3-5}
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 title="Terminal"
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 title="extract_css.py"
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 title="extract_sec-gov_structured.py"
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

| Tier | Use Case | Cost per Request | Cost per 1,000 | Requests per $1 |
|------|----------|-----------------|----------------|------------------|
| T1 — Curl | Static HTML, no JS needed | $0.0002 | $0.20 | 5,000 |
| T2 — HTTP | Standard pages with headers | $0.0003 | $0.30 | 3,333 |
| T3 — Stealth | Protected pages, anti-bot active | $0.002 | $2.00 | 500 |
| T4 — Browser | Full JS rendering required | $0.004 | $4.00 | 250 |
| T5 — CAPTCHA | CAPTCHA solving + JS rendering | $0.02 | $20.00 | 50 |

[View full pricing](/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.2s** — Avg Response
- **$0.002** — Per 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

## Frequently Asked Questions

### Is it legal to scrape sec edgar?

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.

### What are the technical challenges of scraping sec edgar?

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.

### How much does it cost to scrape sec edgar at scale?

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.

## Related

- [How to Scrape Yellow Pages Data: Complete Guide for 2026](<https://alterlab.io/blog/how-to-scrape-yellow-pages-data-complete-guide-for-2026>)
- [Engineering Update: Billing Identity and Deployment Fixes](<https://alterlab.io/blog/engineering-update-billing-identity-and-deployment-fixes>)
- [Understanding Anti-Bot Detection: Fingerprinting, CAPTCHAs, and Rate Limits](<https://alterlab.io/blog/understanding-anti-bot-detection-fingerprinting-captchas-and-rate-limits>)