SEC EDGAR API
Python wrapper for the SEC EDGAR REST API providing access to company filings, submissions, and financial data from the U.S. Securities and Exchange Commission. Supports querying company facts, submissions, and XBRL companion data without requiring API keys.
Warnings
- breaking SEC EDGAR requires a valid User-Agent header with company name and contact email. Requests without it are blocked with 403 errors.
- gotcha CIK numbers must be zero-padded to 10 digits for some endpoints. Passing an unpadded CIK may result in 404 errors.
- gotcha SEC EDGAR enforces rate limiting at 10 requests per second. Exceeding this results in temporary IP blocks.
- gotcha The package import uses underscores (sec_edgar_api) while the pip install name uses hyphens (sec-edgar-api).
- gotcha Returned data is raw JSON from SEC EDGAR as Python dicts. There are no typed models or dataclass wrappers. Key names follow SEC conventions and may be inconsistent.
Install
-
pip install sec-edgar-api
Imports
- EdgarClient
from sec_edgar_api import EdgarClient
Quickstart
from sec_edgar_api import EdgarClient # SEC EDGAR requires a User-Agent header identifying the caller client = EdgarClient(user_agent="MyCompany admin@mycompany.com") # Get submissions for Apple (CIK 0000320193) submissions = client.get_submissions(cik="0000320193") print(submissions["name"]) print(submissions["cik"]) # Get company facts (XBRL data) facts = client.get_company_facts(cik="0000320193") print(list(facts["facts"].keys()))