Full-Text Search of SEC Filings With Python
This page provides ready-to-execute Python code that demonstrates how to run a full-text search on SEC filings using the sec-api
Python package and the Full-Text Search API.
Quick Start
This example demonstrates how to use the sec-api
Python package to query SEC filings and exhibits via the Full-Text Search API, specifically filtering Form 8-K and Form 10-Q filings for keywords like "substantial doubt"
or "going concern"
. The FullTextSearchApi
class’s .get_filings(params)
method retrieves the first 100 results that match the search criteria.
Key parameters used in .get_filings
are as follows:
query
(string): The keyword or phrase to search, such as"substantial doubt" OR "material weakness"
.formTypes
(list of strings, optional): Limits search to specific SEC form types (e.g.,["8-K", "10-Q"]
). Default isNone
(all form types).ciks
(list of strings, optional): Filters results to filings by specified CIKs. Default isNone
(all filers).startDate
(string optional): Start date for the search range inyyyy-mm-dd
format. Used withendDate
to define the date range. Example:"2024-01-01"
. Default is 30 days ago.endDate
(string, optional): End date for the search range, in the same format asstartDate
. Default is today.page
(string, optional): Pagination for results. Default is"1"
.
!pip install sec-api
from sec_api import FullTextSearchApi
fullTextSearchApi = FullTextSearchApi("YOUR_API_KEY")
search_parameters = {
# search filings for "substantial doubt" or "going concern"
# in 8-K and 10-Q forms filed between 2024-01-01 and 2024-03-31
"query": '"substantial doubt" OR "material weakness"',
"formTypes": ["8-K", "10-Q"],
"startDate": "2024-01-01",
"endDate": "2024-03-31",
}
response = fullTextSearchApi.get_filings(search_parameters)
import json
filings_json = response["filings"]
print(f"Total number of filings found: {response['total']['value']}")
print("First 4 search results:")
print(json.dumps(filings_json[:4], indent=2))
Total number of filings found: 1199
First 4 search results:
[
{
"accessionNo": "0001493152-24-000160",
"cik": "1849380",
"companyNameLong": "OneMedNet Corp (ONMD, ONMDW) (CIK 0001849380)",
"ticker": "ONMD",
"description": null,
"formType": "8-K",
"type": "8-K",
"filingUrl": "https://www.sec.gov/Archives/edgar/data/1849380/000149315224000160/form8-k.htm",
"filedAt": "2024-01-03"
},
{
"accessionNo": "0001558370-24-001305",
"cik": "1837607",
"companyNameLong": "AEON Biopharma, Inc. (AEON) (CIK 0001837607)",
"ticker": "AEON",
"description": "8-K",
"formType": "8-K",
"type": "8-K",
"filingUrl": "https://www.sec.gov/Archives/edgar/data/1837607/000155837024001305/aeon-20240214x8k.htm",
"filedAt": "2024-02-16"
},
{
"accessionNo": "0001104659-24-003305",
"cik": "808326",
"companyNameLong": "EMCORE CORP (EMKR) (CIK 0000808326)",
"ticker": "EMKR",
"description": "FORM 8-K",
"formType": "8-K",
"type": "8-K",
"filingUrl": "https://www.sec.gov/Archives/edgar/data/808326/000110465924003305/tm243054d1_8k.htm",
"filedAt": "2024-01-11"
},
{
"accessionNo": "0001017386-24-000024",
"cik": "745543",
"companyNameLong": "PETRO USA, INC. (PBAJ) (CIK 0000745543)",
"ticker": "PBAJ",
"description": "QUARTERLY REPORT",
"formType": "10-Q",
"type": "10-Q",
"filingUrl": "https://www.sec.gov/Archives/edgar/data/745543/000101738624000024/atpt_2023dec31-10q.htm",
"filedAt": "2024-02-21"
}
]
import pandas as pd
filings_df = pd.DataFrame(filings_json)
filings_df.head()
Out:
accessionNo | cik | companyNameLong | ticker | description | formType | type | filingUrl | filedAt | |
---|---|---|---|---|---|---|---|---|---|
0 | 0001493152-24-000160 | 1849380 | OneMedNet Corp (ONMD, ONMDW) (CIK 0001849380) | ONMD | None | 8-K | 8-K | https://www.sec.gov/Archives/edgar/data/184938... | 2024-01-03 |
1 | 0001558370-24-001305 | 1837607 | AEON Biopharma, Inc. (AEON) (CIK 0001837607) | AEON | 8-K | 8-K | 8-K | https://www.sec.gov/Archives/edgar/data/183760... | 2024-02-16 |
2 | 0001104659-24-003305 | 808326 | EMCORE CORP (EMKR) (CIK 0000808326) | EMKR | FORM 8-K | 8-K | 8-K | https://www.sec.gov/Archives/edgar/data/808326... | 2024-01-11 |
3 | 0001017386-24-000024 | 745543 | PETRO USA, INC. (PBAJ) (CIK 0000745543) | PBAJ | QUARTERLY REPORT | 10-Q | 10-Q | https://www.sec.gov/Archives/edgar/data/745543... | 2024-02-21 |
4 | 0001829126-24-000775 | 1853044 | Aeries Technology, Inc. (AERT, AERTW) (CIK 000... | AERT | 8-K | 8-K | 8-K | https://www.sec.gov/Archives/edgar/data/185304... | 2024-02-07 |