SDKs overview
The Electronic Data Gathering, Analysis, and Retrieval (EDGAR) system, maintained by the U.S. Securities and Exchange Commission (SEC), serves as the primary repository for company filings required by law. These filings include financial statements, prospectuses, and other disclosures from public companies. While the SEC ensures public access to this extensive dataset, it does not currently provide official Software Development Kits (SDKs) or a dedicated programmatic API for direct integration. Instead, developers typically interact with EDGAR data through direct web scraping of the SEC website, downloading bulk data files, or utilizing various community-developed libraries and third-party commercial APIs that abstract the complexities of data acquisition and parsing.
The absence of official SDKs means that developers often create custom solutions to navigate the EDGAR database, retrieve specific filings (such as 10-K, 10-Q, 8-K forms), and extract relevant information. This process often involves understanding the structure of HTML, XML, or XBRL documents published by the SEC. Community libraries aim to simplify this interaction by providing pre-built functions for common tasks like searching for companies, downloading filings, and parsing the content into more structured formats, such as Pandas DataFrames in Python, or JSON objects. These tools are crucial for academic researchers, financial analysts, and developers building applications that require current or historical SEC filing data.
Official SDKs by language
As of 2026, the U.S. Securities and Exchange Commission (SEC) does not publish or maintain official SDKs for interacting with its EDGAR database. The SEC's primary method for public data dissemination is through its website, which allows users to search and download filings directly. The SEC provides information on how to access EDGAR data and bulk downloads, but programmatic interfaces are not directly supported by official tools.
The data is available in various formats, including HTML, plain text, and eXtensible Business Reporting Language (XBRL). XBRL, in particular, is a machine-readable format designed for financial reporting, and its structure allows for more efficient programmatic parsing compared to raw HTML or text. However, interacting with XBRL data still requires specialized parsers, which are typically found in community-developed libraries rather than official SDKs. For example, the SEC mandates XBRL filing for certain financial statements, which can be accessed for analysis.
| Language | Package/Approach | Install Command | Maturity |
|---|---|---|---|
| Python | Direct web requests & parsing (e.g., requests, BeautifulSoup) |
pip install requests beautifulsoup4 |
Stable (fundamental libraries) |
| R | Direct web requests & parsing (e.g., httr, rvest) |
install.packages(c("httr", "rvest")) |
Stable (fundamental libraries) |
| JavaScript (Node.js) | Direct web requests & parsing (e.g., axios, cheerio) |
npm install axios cheerio |
Stable (fundamental libraries) |
| Java | Direct web requests & parsing (e.g., Jsoup, Apache HttpClient) |
Add dependencies to pom.xml or build.gradle |
Stable (fundamental libraries) |
Installation
Since there are no official SDKs, installation typically refers to setting up the necessary programming language environment and installing general-purpose web scraping and parsing libraries. The following provides installation instructions for common environments used to interact with SEC EDGAR data.
Python
Python is a widely used language for data analysis and web scraping due to its extensive library ecosystem. To get started, you'll need pip, Python's package installer, which usually comes bundled with Python installations.
- Install Python: If you don't have Python installed, download it from the official Python website.
- Install Libraries: Use
pipto installrequestsfor making HTTP requests andBeautifulSoup4(bs4) for parsing HTML content. - Optional: XBRL Parsing: For more structured data extraction from XBRL filings, you might use libraries like
xbrl-extractororpyspdr.
pip install requests beautifulsoup4 pandas lxml
pip install xbrl-extractor
R
R is popular in statistical computing and financial analysis. The following libraries are commonly used for web data acquisition:
- Install R & RStudio: Download R from CRAN and RStudio Desktop from the RStudio website.
- Install Libraries: Use
install.packages()to gethttrfor HTTP requests andrvestfor HTML parsing.
install.packages(c("httr", "rvest", "xml2"))
JavaScript (Node.js)
For server-side applications using JavaScript, Node.js provides a robust environment. The npm package manager is included with Node.js.
- Install Node.js: Download and install Node.js from the Node.js official site.
- Install Libraries: Use
npmto installaxiosfor HTTP requests andcheeriofor jQuery-like HTML parsing on the server.
npm install axios cheerio
Java
Java developers can use various libraries for web interaction and parsing. Apache HttpClient is a common choice for HTTP requests, and Jsoup for HTML parsing.
- Install Java Development Kit (JDK): Ensure you have a JDK installed and configured.
- Project Setup: For Maven projects, add the following dependencies to your
pom.xml: - For Gradle projects, add to your
build.gradle:
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
</dependency>
</dependencies>
dependencies {
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'org.jsoup:jsoup:1.14.3'
}
Quickstart example
This Python example demonstrates how to download a recent 10-K filing for Apple Inc. (AAPL) using basic web scraping techniques. It retrieves the list of filings, identifies the latest 10-K, and downloads its HTML content. This approach simulates how a community library might operate under the hood.
Python Quickstart: Retrieving Apple's Latest 10-K
import requests
from bs4 import BeautifulSoup
import re
import time
def get_cik(ticker):
"""Fetches the CIK for a given ticker symbol."""
headers = {'User-Agent': 'Your Name [email protected]'}
search_url = f"https://www.sec.gov/cgi-bin/browse-edgar?company={ticker}&owner=exclude&action=getcompany"
response = requests.get(search_url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')
cik_link = soup.find('a', href=re.compile(r'CIK=\d+'))
if cik_link:
cik = cik_link.text.strip().split(' ')[0]
return cik
return None
def get_filing_documents(cik, form_type='10-K', num_filings=1):
"""Retrieves the document links for a specified number of filings of a given type."""
headers = {'User-Agent': 'Your Name [email protected]'}
filings_url = f"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK={cik}&type={form_type}&count={num_filings}&output=xml"
response = requests.get(filings_url, headers=headers)
soup = BeautifulSoup(response.text, 'xml') # Use xml parser for the RSS feed
documents = []
for item in soup.find_all('item'):
accession_number = item.find('accession-number').text if item.find('accession-number') else None
filing_href = item.find('filing-href').text if item.find('filing-href') else None
if filing_href and accession_number:
# Construct the URL to the actual document table
base_url = filing_href.rsplit('/', 1)[0] + '/index.xml' # Get base path to find document index
# Fetch the index.xml to find the primary document link
index_response = requests.get(base_url, headers=headers)
index_soup = BeautifulSoup(index_response.text, 'xml')
primary_doc_link = None
for doc in index_soup.find_all('document'):
if doc.find('type').text == form_type and doc.find('sequence').text == '1': # Often sequence 1 is the main document
primary_doc_link = base_url.replace('index.xml', doc.find('filename').text)
break
if primary_doc_link:
documents.append({
'accession_number': accession_number,
'filing_url': primary_doc_link
})
return documents
# Example Usage
ticker = 'AAPL'
cik = get_cik(ticker)
if cik:
print(f"Found CIK for {ticker}: {cik}")
# SEC requests a delay between requests to avoid being blocked
time.sleep(1)
latest_10k_docs = get_filing_documents(cik, form_type='10-K', num_filings=1)
if latest_10k_docs:
latest_10k = latest_10k_docs[0]
print(f"Downloading latest 10-K from: {latest_10k['filing_url']}")
try:
headers = {'User-Agent': 'Your Name [email protected]'}
doc_response = requests.get(latest_10k['filing_url'], headers=headers)
doc_response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)
# Save the content to a file
filename = f"{ticker}_{latest_10k['accession_number']}.html"
with open(filename, 'w', encoding='utf-8') as f:
f.write(doc_response.text)
print(f"Successfully downloaded {filename}")
except requests.exceptions.RequestException as e:
print(f"Error downloading document: {e}")
else:
print(f"No 10-K filings found for {ticker}.")
else:
print(f"Could not find CIK for {ticker}.")
Explanation:
- The
get_cikfunction performs a search on the SEC EDGAR site to find the Central Index Key (CIK) for a given stock ticker. The CIK is a unique identifier used by the SEC. - The
get_filing_documentsfunction then uses the CIK to query the SEC's RSS feed for filings of a specific type (e.g., '10-K'). It parses this XML feed to find the URL of the primary document within the filing. - Finally, the script downloads the content of the identified 10-K document and saves it as an HTML file.
- User-Agent: It's crucial to include a descriptive
User-Agentheader in your requests. The SEC explicitly requests that automated tools identify themselves to avoid being blocked. - Rate Limiting: The SEC also advises against making excessive requests. Including
time.sleep(1)helps to adhere to their guidelines and prevent IP blocking.
Community libraries
Given the lack of official SDKs, the community has developed numerous libraries to simplify interaction with SEC EDGAR data. These libraries often wrap the complex logic of fetching, parsing, and cleaning EDGAR filings.
Python
sec-edgar-downloader: A popular Python library for downloading SEC EDGAR filings. It simplifies the process of fetching various filing types (e.g., 10-K, 10-Q, 8-K) by CIK or ticker symbol. It handles the underlying HTTP requests and file saving.secedgar: Provides a more comprehensive interface for querying and downloading SEC EDGAR filings. It supports various ways of searching for filings and aims to standardize the data retrieval process.xbrl-extractor: Focuses specifically on extracting financial data from XBRL filings into structured formats, often Pandas DataFrames, making it easier for quantitative analysis.pyspdr: Another library for parsing XBRL data, enabling developers to access financial statements and notes in a structured manner.
R
edgar: An R package designed to download and parse SEC EDGAR filings. It provides functions to search for companies, retrieve filing documents, and extract information for financial analysis.XBRL: This package allows R users to read and process XBRL instance documents, which is essential for working with the structured financial data provided by the SEC.
Other Languages and Approaches
- Third-party APIs: Several commercial and free third-party APIs exist that provide structured access to EDGAR data, often with additional processing and historical data. Examples include services from companies like Intrinio, Alpha Vantage, and others. These services handle the data acquisition and parsing on their end, offering clean JSON or CSV outputs via their own APIs. While not community libraries directly, they are a common alternative for developers seeking a more managed solution.
- Custom Scraping Solutions: Many developers opt to build their own custom web scrapers using general-purpose HTTP client libraries (like
requestsin Python,axiosin Node.js,httrin R, or Apache HttpClient in Java) combined with HTML/XML parsers (likeBeautifulSoup,cheerio,rvest,Jsoup). This approach offers maximum flexibility but requires more development effort to handle edge cases, rate limits, and evolving website structures.