SEC EDGAR API
raw JSON → 0.1.7 verified Tue May 12 auth: no python install: stale quickstart: stale
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 Common errors
error ModuleNotFoundError: No module named 'sec_edgar_api' ↓
cause The 'sec-edgar-api' library is either not installed in the current Python environment or there is a typo in the import statement.
fix
Install the library using pip:
pip install sec-edgar-api and ensure the import statement is from sec_edgar_api import SecEdgarApi. error TypeError: 'NoneType' object is not subscriptable ↓
cause An API call method (e.g., `get_submissions`, `get_company_facts`) returned `None` due to a network error, invalid CIK/ticker, or an issue with the SEC EDGAR API, and the code subsequently tried to access it as if it were a dictionary or list.
fix
Always check if the result of an API call is not
None before attempting to access its contents, for example: data = api.get_submissions('AAPL'); if data: print(data['entityRegistrant']['cik']). error KeyError: 'some_missing_key' ↓
cause The API response, which is parsed into a Python dictionary, does not contain the specific key being accessed, possibly because the data structure varies between filings or the key name is misspelled.
fix
Use the
.get() method with a default value, or check for the key's existence using if 'key' in data_dict: before attempting to access it, for example: cik = data.get('entityRegistrant', {}).get('cik'). error TypeError: 'module' object is not callable ↓
cause The code attempted to call the `sec_edgar_api` module directly as a function instead of importing and instantiating the `SecEdgarApi` class from within it.
fix
Import the
SecEdgarApi class and then create an instance of it before calling its methods: from sec_edgar_api import SecEdgarApi; api = SecEdgarApi(); submissions = api.get_submissions('AAPL'). Warnings
breaking SEC 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.
gotcha CIK 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)
gotcha SEC 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.
gotcha The 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'.
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. ↓
fix Inspect response dicts carefully and handle missing keys defensively with .get().
breaking The `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.
Install compatibility stale last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - - -
3.10 slim (glibc) - - - -
3.11 alpine (musl) - - - -
3.11 slim (glibc) - - - -
3.12 alpine (musl) - - - -
3.12 slim (glibc) - - - -
3.13 alpine (musl) - - - -
3.13 slim (glibc) - - - -
3.9 alpine (musl) - - 0.74s 20.8M
3.9 slim (glibc) - - 0.69s 21M
Imports
- EdgarClient wrong
from sec_edgar_api import SECEdgarAPIcorrectfrom sec_edgar_api import EdgarClient
Quickstart stale last tested: 2026-05-12
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()))