SEC API Python Client

1.0.35 · active · verified Sun Apr 12

The `sec-api` Python library provides a robust client for accessing SEC EDGAR filings data. It offers various APIs for querying, full-text searching, real-time streaming, and converting/extracting structured data from over 20 million filings and 800,000+ entities, dating back to 1993 with real-time updates. The library is actively maintained, with frequent updates adding new API wrappers and features. The current version is 1.0.35.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the QueryApi to retrieve metadata for the latest 50 EDGAR filings for Tesla. Remember to replace 'YOUR_API_KEY' with a valid API key or set the 'SEC_API_KEY' environment variable.

import os
from sec_api import QueryApi

# Get your free API key at sec-api.io
API_KEY = os.environ.get("SEC_API_KEY", "YOUR_API_KEY") 

queryApi = QueryApi(api_key=API_KEY)

search_params = {
    "query": "ticker:TSLA",
    "from": "0",
    "size": "50",
    "sort": [{"filedAt": {"order": "desc"}}]
}

response = queryApi.get_filings(search_params)

print(f"Total filings for TSLA: {response['total']['value']}")
for filing in response['filings']:
    print(f"  - {filing['formType']} filed on {filing['filedAt']}: {filing['linkToFilingDetails']}")

view raw JSON →