Registry / http-networking / sec-edgar-api

sec-edgar-api

JSON →
library1.1.0pypypi✓ verified 26d ago

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.

pip install sec-edgar-api
INSTALL
IMPORT
SIG · SEC-EDGAR-API
S
sec-edgar-api
http-networkingpythonv1.1.0
Install
2.6s avg
Import
530ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.124s · 21.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.088s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EdgarClient
from sec_edgar_api import EdgarClient
from sec_edgar_api import EdgarClient

Fetch SEC EDGAR submissions and company facts for Apple Inc.

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()))
Debug
Known issues
breakingSEC EDGAR requires a valid User-Agent header with company name and contact email. Requests without it are blocked with 403 errors.
fix
Always pass user_agent='YourName yourname@example.com' when creating EdgarClient.
affects: all
gotchaCIK numbers must be zero-padded to 10 digits for some endpoints. Passing an unpadded CIK may result in 404 errors.
fix
Zero-pad CIK strings: cik = str(cik).zfill(10)
affects: all
gotchaSEC EDGAR enforces rate limiting at 10 requests per second. Exceeding this results in temporary IP blocks.
fix
Add delays between requests with time.sleep(0.1) or use a rate limiter.
affects: all
gotchaThe package import uses underscores (sec_edgar_api) while the pip install name uses hyphens (sec-edgar-api).
fix
Use 'from sec_edgar_api import EdgarClient' after installing with 'pip install sec-edgar-api'.
affects: all
gotchaReturned 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.
fix
Inspect response dicts carefully and handle missing keys defensively with .get().
affects: all
breakingThe `sec-edgar-api` library is incompatible with Python 3.13, resulting in a `TypeError: Limiter.__init__() got an unexpected keyword argument 'raise_when_fail'`. This indicates a mismatch between the library's internal rate limiter implementation and its dependencies or the Python version.
fix
Use a Python version between 3.8 and 3.12, or check for an updated version of the `sec-edgar-api` library that explicitly supports Python 3.13.
affects: python:3.13
Upgrade
Version history
1.1.0latest on PyPI · released Sep 30, 2023
Audit
Dependencies
requestsrequiredCore HTTP client used for all SEC EDGAR API requests.
Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
sec-edgar-api — pip install sec-edgar-api · libregistry