Skip to main content

Python SEC

PyPI version Python versions License: MIT

A lightweight Python client for the SEC EDGAR API. Look up companies by ticker, search filings, download documents, and query XBRL financial data — all in a few lines of code.

Quick Start

pip install python-sec
from edgar.client import EdgarClient

# SEC requires a User-Agent identifying you.
client = EdgarClient(user_agent="Your Name your-email@example.com")

# Look up Apple's 10-K filings — by ticker, no CIK needed.
company = client.company("AAPL")
filings = company.get_filings(form="10-K")

print(filings[0])
# <Filing form='10-K' date='2024-11-01' title='10-K - Annual report ...'>

# Get structured company metadata.
info = company.get_info()
print(info.name, info.tickers, info.sic_description)
# Apple Inc. ['AAPL'] ELECTRONIC COMPUTERS

# Access XBRL facts.
facts = company.xbrl_facts()

Installation

pip install python-sec          # from PyPI
pip install --upgrade python-sec  # upgrade
pip install -e .                 # local dev (editable mode)

Services

Service Access Description
Company client.company("AAPL") Fluent interface — ticker/CIK → filings, submissions, XBRL
Tickers client.resolve_ticker("AAPL") Resolve tickers ↔ CIK numbers, search by company name
Filings client.filings() Search filings by CIK, form type, date range, company name
Companies client.companies() Query companies by state, country, SIC code, name
Submissions client.submissions() Full filing history for any entity via the REST API
XBRL client.xbrl() Company facts, concepts, and cross-company frames
Archives client.archives() Browse EDGAR archive directories
Current Events client.current_events() Recent RSS filing feeds
Datasets client.datasets() DERA financial datasets
Issuers client.issuers() Issuer information
Mutual Funds client.mutual_funds() Mutual fund filings
Series client.series() Investment company series
Ownership Filings client.ownership_filings() Insider ownership (Forms 3/4/5)
Variable Insurance client.variable_insurance_products() Variable insurance product filings
Download client.download(url) Fetch any filing document (HTML, XML, PDF)

Usage Examples

Ticker Resolution

# Ticker → CIK
cik = client.resolve_ticker("MSFT")  # "0000789019"

# CIK → company info
entries = client.resolve_cik("789019")
# [{'cik_str': 789019, 'ticker': 'MSFT', 'title': 'MICROSOFT CORP'}]

# Search by company name
results = client.tickers().search("Tesla")

Company Research (Fluent API)

company = client.company("META")

# Structured Filing objects with typed properties.
filings = company.get_filings(form="10-K")
for f in filings[:3]:
    print(f.form_type, f.filing_date[:10], f.url)

# Structured CompanyInfo with typed properties.
info = company.get_info()
print(info.name, info.sic_description, info.fiscal_year_end)

# Recent submissions as Submission objects.
for sub in info.recent_submissions[:5]:
    print(sub.form, sub.filing_date, sub.accession_number)

Filing Search

filings_service = client.filings()

# By CIK
filings_service.get_filings_by_cik(cik="320193")

# By form type
filings_service.get_filings_by_type(cik="320193", filing_type="10-K")

# Complex query with date range
filings_service.query(
    cik="320193",
    filing_type="10-Q",
    after_date="2023-01-01",
    before_date="2024-01-01",
)

XBRL Financial Data

xbrl = client.xbrl()

# All facts for a company.
facts = xbrl.company_facts(cik="320193")

# A single concept across time.
revenue = xbrl.company_concepts(cik="320193", concept="us-gaap/Revenue")

# Cross-company comparison for a single period.
frame = xbrl.frames(taxonomy="us-gaap", concept="AccountsPayableCurrent", uom="USD", period="CY2023Q1I")

Download Filing Documents

# Download as text.
html = client.download("https://www.sec.gov/Archives/edgar/data/320193/filing.htm")

# Download and save to file.
client.download("https://www.sec.gov/Archives/edgar/data/320193/filing.htm", path="filing.html")

# Download through the Company interface.
company = client.company("AAPL")
filings = company.get_filings(form="10-K")
content = company.download(filings[0].url)

Response Models

The library provides structured dataclass models alongside raw dictionary access:

Model Wraps Key Properties
Filing Filing search results form_type, filing_date, url, accession_number, title, summary
CompanyInfo Submissions metadata name, cik, tickers, sic, sic_description, recent_submissions
Submission Individual filing records form, filing_date, accession_number, report_date, is_xbrl

All models expose a .raw attribute containing the original dictionary for backward compatibility.

Support These Projects

Patreon: Help support this project and future projects by donating to my Patreon Page. I'm always looking to add more content for individuals like yourself, unfortunately some of the APIs would require me to pay monthly fees.

YouTube: If you'd like to watch more of my content, feel free to visit my YouTube channel Sigma Coding.

Questions: If you have questions please feel free to reach out to me at coding.sigma@gmail.com

Metadata

Release files for python-sec 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-sec 0.2.0
File Size Uploaded Provenance
python_sec-0.2.0.tar.gz 95.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for python-sec 0.2.0
File Interpreter ABI Platform
python_sec-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 172.1 kB

Release files / python_sec-0.2.0.tar.gz

Download URL python_sec-0.2.0.tar.gz
Size 95.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5c3d9d26fb6f6d8029daf4ec4c215954aa02422f8f8ab8003be5be52a702a4f4
BLAKE2b-256 checksum
How to use checksums
89104cd13be6a56419d96a1fb00879752a6db8969942a7301cc85801caac6cde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.

Transparency log

Release files / python_sec-0.2.0-py3-none-any.whl

Download URL python_sec-0.2.0-py3-none-any.whl
Size 77.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c69ddca992a64d5a079a023c6ec3b0f85fbae52632a44bf243b0f9d2f382fc8
BLAKE2b-256 checksum
How to use checksums
ba475a7cc3e1cd004ddb0382fbaa5cba7faaeb9a923f9ce575422350b9ac4b99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.

Transparency log

Security for python-sec 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for python_sec-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page