← Back to blog

How to Scrape SEC Disclosures into Structured Data

July 3, 2026
How to Scrape SEC Disclosures into Structured Data

TL;DR:

  • Scraping SEC disclosures into structured data involves extracting financial and regulatory information from filings and converting it into machine-readable formats. Following a five-step pipeline ensures reliable results, including CIK resolution, direct Inline XBRL parsing, and industry-aware normalization. Accurate, validated data supports compliance, financial analysis, and AI-driven insights through standardized schemas and MCP integration.

Scraping SEC disclosures into structured data is the process of programmatically extracting financial and regulatory information from SEC EDGAR filings and converting it into typed, machine-readable formats like JSON or tabular records. The SEC publishes thousands of filings daily across form types including 10-K, 10-Q, and 8-K. Pulling that raw HTML or XML into a clean, queryable schema requires more than a basic web scraper. You need XBRL parsing, schema validation, and industry-aware normalization to get data you can actually trust for compliance monitoring or financial analysis.

What tools and prerequisites do you need to scrape SEC disclosures?

Python is the dominant language for SEC data extraction, with the widest library support and the most active open-source tooling. Other languages can call the EDGAR REST API directly, but Python gives you the most complete path from raw filing to validated output.

The core toolkit breaks down into four categories:

  • XBRL parsers: Libraries like edgartools resolve company entities to CIK identifiers and normalize XBRL facts based on dimensional qualifiers and fiscal period matching. That CIK-first design pattern is the right starting point for any pipeline.
  • Schema validation: Pydantic models enforce typed output after you convert filing HTML to markdown. Pydantic-based structured extraction using LLMs and markdown conversion improves pipeline reliability compared to regex-based approaches.
  • EDGAR clients: The SEC EDGAR full-text search and company facts APIs are public and free. Libraries like edgar-ts wrap these endpoints with built-in rate-limit awareness.
  • Filing type knowledge: Know the difference between 10-K (annual), 10-Q (quarterly), 8-K (current events), and DEF 14A (proxy). Each has a different structure and different XBRL tagging density.

Pro Tip: Cache EDGAR responses locally during development. The SEC enforces a hard rate limit of 8 requests per second, and hitting it repeatedly during testing will get your IP temporarily blocked.

Securing access is straightforward. EDGAR's public endpoints require only a valid User-Agent header identifying your organization and email. No API key is needed for standard access.

Infographic depicting five-step SEC scraping process flow

How do you execute scraping and parse SEC filings step by step?

The most reliable pipeline follows five discrete steps. Each step has a clear input and output, which makes debugging and scaling much easier.

  1. Resolve the company to a CIK. Every SEC filer has a Central Index Key. Use the EDGAR company search endpoint or edgartools to map a ticker or company name to its CIK before you request any filings. This avoids ambiguity when company names change or merge.

  2. Retrieve filings by form type and date. Query the EDGAR submissions endpoint for a given CIK, then filter by form type and date range. Most EDGAR client libraries expose this as a single method call. Return the accession number and filing index URL for each result.

  3. Parse Inline XBRL directly from the filing HTML. Parsing iXBRL directly from SEC filings lets you extract data immediately upon filing release, without waiting for the SEC to publish official Interactive Data files. This can cut your data latency from days to minutes.

  4. Apply industry-aware XBRL extraction. Generic XBRL parsers miss industry-specific concepts. Industry-aware extraction standardizes roughly 250 financial concepts across five industry classes: standard, bank, insurance, REIT, and utility. That mapping is what makes revenue figures from a bank actually comparable to revenue figures from another bank, rather than being silently misclassified.

  5. Validate and normalize output with Pydantic. Define a Pydantic model for each filing type you care about. Run every extracted record through it before writing to your database or DataFrame. This catches sign errors, missing fields, and type mismatches at ingestion time rather than downstream.

Pro Tip: For financial document extraction to JSON, define separate Pydantic models per industry class. A bank's balance sheet has materially different required fields than a manufacturer's.

Tools worth knowing: edgartools handles CIK resolution and filing retrieval. SEC-Analyzer handles the markdown conversion and LLM-assisted extraction step. The SEC-MCP project exposes these capabilities as Model Context Protocol tools for AI agent workflows.

Hands typing on keyboard with SEC scraping tools

What are the common challenges when scraping SEC disclosures?

Even a well-designed pipeline hits friction. The problems below account for the majority of data quality failures in production SEC extraction systems.

  • Rate limits: EDGAR enforces 8 requests per second. Exceeding this triggers 429 errors. Use exponential backoff and a local cache keyed on accession number. Never re-fetch a filing you already have.
  • Inconsistent filing structures: Not every filer uses the same HTML layout or XBRL tag set. Some 10-Ks embed financial tables as images. Others omit entire sections. Your parser must handle missing sections gracefully rather than throwing exceptions.
  • Sign normalization: Sign normalization and fuzzy metric matching are critical because companies use varying label conventions for core financial concepts. A liability might be reported as a positive or negative number depending on the filer's convention. Negated-label flipping logic is not optional.
  • Label variation and fuzzy matching: "Net revenues," "total net revenue," and "revenues, net" all mean the same thing. Build a fuzzy matching layer that maps these variants to a canonical concept name before aggregating.
  • CIK normalization for metadata: Company names change through acquisitions and rebranding. Always anchor your records to CIK, not to the company name string. This keeps your historical data consistent across name changes.
  • Evolving filing formats: The SEC updates its XBRL taxonomy periodically. Pin your parser to a known taxonomy version in testing, and build a monitoring step that flags filings using tags outside your expected set.

The structured data extraction guide on schema validation covers how to build the normalization layer so these issues surface as typed errors rather than silent bad data.

How do you use scraped SEC data for compliance and financial analysis?

Once your pipeline produces validated JSON or typed records, the downstream applications are wide. Structured financials, textual sections, and derived metrics can all be parsed from diverse SEC filings, supporting full analysis pipelines from a single extraction pass.

The table below maps common use cases to the data type and recommended output format:

Use caseData typeOutput format
Revenue trend analysisStructured financialspandas DataFrame
Risk factor monitoringMD&A text sectionsJSON with embeddings
Compliance screeningFiling metadata + flagsRelational database
AI agent research queriesAll typesMCP tool response
Cross-industry comparisonIndustry-normalized XBRLTyped JSON schema

For quantitative work, load your Pydantic-validated records directly into pandas DataFrames. Run automated sanity checks: revenue should exceed net income, total assets should equal liabilities plus equity. These checks catch extraction errors before they corrupt downstream models.

For qualitative work, extract the MD&A and Risk Factors sections as plain text. Feed them into an embedding model for semantic search or anomaly detection across filing periods.

Model Context Protocol enables AI agents to query SEC filing data in real-time without proprietary API wrappers. That means your compliance agent can call a live SEC tool, get a typed response, and reason about the result without any custom glue code. This is where structured data for investment research is heading in 2026: agent-native pipelines that consume MCP endpoints directly.

Pro Tip: For LLM-friendly markdown from web sources, convert filing HTML to clean markdown before passing it to an LLM. Token counts drop significantly, and extraction accuracy improves.

Key Takeaways

Scraping SEC disclosures into structured data requires CIK-anchored retrieval, direct Inline XBRL parsing, industry-aware normalization, and Pydantic schema validation to produce reliable, analysis-ready output.

PointDetails
Start with CIK resolutionAlways map companies to their CIK before fetching filings to avoid name-change ambiguity.
Parse iXBRL directlySkip official Interactive Data files and extract from Inline XBRL at filing release for faster data access.
Use industry-aware extractionApply the five-class XBRL mapping to correctly categorize concepts for banks, REITs, and utilities.
Validate with PydanticRun every record through a typed schema at ingestion to catch sign errors and missing fields early.
Integrate via MCP for agentsUse Model Context Protocol endpoints to feed structured SEC data into AI agents without custom wrappers.

Why I think most SEC scrapers fail before they even start

The failure mode I see most often is not a technical one. Developers build a scraper that works on five test filings and then ship it to production. Three months later, the pipeline is silently producing wrong numbers because a bank filer used a non-standard XBRL tag, and nobody built the industry-aware mapping layer.

Regex-based scraping is the other trap. It works until the SEC updates its filing template, and then it breaks in ways that are hard to detect. The move to Pydantic-validated, schema-driven extraction is not just a code quality preference. It is the only approach that surfaces failures as errors rather than as corrupted data.

The part of this problem that genuinely excites me is the MCP integration path. Compliance and financial analysts increasingly rely on AI agents that consume SEC data via standardized MCP endpoints, which removes the need for bespoke API wrappers on every new tool. That shift is real and accelerating. The teams building agent-native pipelines today will have a structural advantage in 2026 and beyond.

My practical advice: build the industry-aware XBRL layer from day one, even if you only cover standard and bank classes initially. Retrofitting it later means reprocessing your entire historical dataset.

— Glen

Gyrence and structured SEC data extraction

Gyrence is built for exactly this kind of extraction work. Its five composable primitives, Search, Traverse, Fetch, Extract, and Map, give you a clean path from a raw EDGAR filing URL to structured, agent-ready JSON without stitching together five separate libraries.

https://www.gyrence.com

The Extract primitive accepts a prompt or schema and returns typed JSON with discriminated-union failure modes, so your pipeline knows exactly what went wrong when a filing is malformed. The hosted MCP endpoint means your AI agents can query live web data, including SEC filings, without managing scraping infrastructure. Spending caps and structured failure responses mean your bill and your data quality are both predictable. Explore Gyrence's web data infrastructure to see how it fits your SEC extraction workflow.

FAQ

What is the best format for structured SEC data extraction?

JSON with Pydantic schema validation is the most reliable output format. It enforces typed fields, catches sign errors at ingestion, and integrates directly with pandas and AI agent workflows.

How do I handle SEC EDGAR rate limits when scraping?

EDGAR enforces a limit of 8 requests per second. Use exponential backoff, cache responses locally by accession number, and never re-fetch filings you already have stored.

What is Inline XBRL and why does it matter for SEC parsing?

Inline XBRL (iXBRL) embeds machine-readable financial tags directly in the filing's HTML. Parsing it directly gives you structured data at filing release, days before the SEC publishes official Interactive Data files.

How does MCP help with automated SEC disclosure scraping?

Model Context Protocol lets AI agents call SEC data tools in real-time and receive typed responses without custom API wrappers, making it the preferred integration pattern for agent-native compliance pipelines.

Why does industry-aware XBRL extraction matter?

Generic parsers misclassify financial concepts for banks, REITs, and utilities. Industry-aware extraction maps roughly 250 concepts across five industry classes, producing data that is actually comparable within a sector.