Home / Tutorials / Setup
Setup

SEC EDGAR API quickstart in Python

Make your first SecFeed API call from Python in five minutes: get a key, search EDGAR filings and read the JSON response.

This quickstart gets you from zero to real SEC filing data in a few minutes. You will create a key, call the Filing Query API with requests, and read the response.

1. Get an API key

Create a free account at secfeedapi.com/signup. Your key is on the dashboard. The free plan includes 500 calls a month, which is plenty for every tutorial on this site.

Store it in an environment variable so it never ends up in your code:

export SECFEED_KEY=your_key_here
pip install requests

2. Authenticate

Every request carries the key in an Authorization: Bearer header. You can also pass ?token=YOUR_KEY as a query parameter, which is handy in a browser, but the header keeps keys out of logs.

3. Search filings

The /v1/filings endpoint searches the full EDGAR index since 1993. The query parameter takes Lucene style syntax; ticker:AAPL returns everything filed for Apple, newest first.

import os
import requests

BASE = "https://secfeedapi.com"
HEADERS = {"Authorization": f"Bearer {os.environ['SECFEED_KEY']}"}

r = requests.get(f"{BASE}/v1/filings", params={"query": "ticker:AAPL", "size": 3}, headers=HEADERS, timeout=60)
r.raise_for_status()
data = r.json()
print("total:", data["total"]["value"])
for f in data["filings"]:
    print(f["filedAt"], f["formType"], f["companyName"], f["accessionNo"])

Real output:

total: 2265
2026-10-08 4 Apple Inc. 0001140361-26-039158
2026-10-05 4 Apple Inc. 0001140361-26-038674
2026-10-05 4 Apple Inc. 0001140361-26-038672

Each filing has an accessionNo (the unique EDGAR id), the form type, the filing date and two links: linkToFilingDetails (the EDGAR index page) and linkToTxt (the full submission). Those links are what you pass to the download, PDF and extractor endpoints.

4. What the response looks like

total.value is the number of matching filings. filings holds up to size results (maximum 200). Page through with from:

params = {"query": "ticker:AAPL", "size": 200, "from": 200}

5. Handle errors

The API returns standard HTTP status codes. A 401 means the key is missing or wrong, 429 means you used the month's quota, and 400 comes with a JSON error message, for example when a query cannot be parsed. Call r.raise_for_status() as above, or check r.status_code yourself.

Next steps

More setup tutorials

Run this tutorial with your own key

500 free API calls a month. Every example on this page works on the free plan.

Get free API key →