Read a daily SEC filing index with Python

Retrieve a published daily master index, preserve its source metadata, and distinguish daily filing discovery from real-time alerts.

WHAT YOU WILL BUILD

Request one published daily SEC master index and inspect the filtered result page. The daily index is a source for batch discovery, not a real-time stream.

Requirements: Python 3.10 or later; standard library only. An API key from your dashboard, stored in the SEC_API_KEY environment variable.

Run the workflow

Save this as workflow.py and run python3 workflow.py. The production base URL is used by default. Keep credentials out of source control.

import json
import os
from urllib.parse import urlencode
from urllib.request import Request, urlopen
key = os.environ["SEC_API_KEY"]
base = os.environ.get("SEC_API_BASE_URL", "https://sec-api.dev")
params = urlencode({"date": "2026-10-23", "form": "10-K", "limit": 20})
request = Request(base + "/api/v1/filing-index?" + params,
                  headers={"Authorization": "Bearer " + key})
with urlopen(request, timeout=30) as response:
    result = json.load(response)
print(json.dumps({"records": result["data"], "pagination": result["pagination"],
                  "source": result["meta"]}, indent=2))

Choose a published source date

The sample uses a fixed weekday date. Weekends, holidays, or not-yet-published dates may have no source index. A missing source should not be converted into a definitive claim that no filings occurred. Inspect the error response and retry policy rather than silently writing an empty report.

Treat the index as discovery metadata

A daily master index helps identify filing records for subsequent retrieval. It is not the actual document text, a parsed financial statement, or a holdings table. Preserve the CIK, form, filing date, and source filing link. Use accession-aware document workflows when you need the underlying contents.

Design a bounded batch job

Follow pagination to finish the selected date and filter, recording completion explicitly. A date-by-date job should retain its last successfully completed date, rate-limit its requests, and retry only transient failures. This tutorial is one request and does not set up a scheduler or claim streaming latency. Use the source retrieval metadata to distinguish an old cached index from a newly retrieved one.

Sources and further reading

The underlying SEC dataset behavior is documented in the official SEC API reference and SEC technical specifications. Response-field names shown here belong to the sec-api.dev endpoint contract. The scripts print actual results and do not embed fabricated filing or financial data.

All tutorials ←