DEV Community

linderroger-eng
linderroger-eng

Posted on

I Built a Free API to Search SEC EDGAR by Ticker Symbol (No CIK Lookup Needed)

Every developer who has tried to pull financial data from the SEC knows the pain. You want Apple's annual reports. Simple enough, right?

Wrong.

First, you discover SEC EDGAR doesn't know what "AAPL" means. You need a CIK — a Central Index Key — which for Apple is 0000320193. So you go hunt that down. Then you hit the EDGAR full-text search API, wrestle with paginated XML responses, try to parse XBRL inline documents, decode filing index pages, and somehow extract the actual data buried inside. By the time you've got one number out, you've written 200 lines of boilerplate.

I got tired of doing this for every project. So I built a wrapper API that lets you query SEC EDGAR by ticker symbol and get clean JSON back.


The Problem with Raw SEC EDGAR

Here's what it actually looks like to pull Apple's 10-K filings from the raw SEC API:

import requests

ticker = "AAPL"
# Step 1: Hit the company search to find CIK...
r = requests.get("https://efts.sec.gov/LATEST/search-index?q=AAPL&forms=10-K")
# Step 2: Parse XML response...
# Step 3: Extract CIK from nested structure...
# Step 4: Hit another endpoint with the CIK...
# Step 5: Parse filing index pages...
# Step 6: Decode inline XBRL inside HTML...
# 200 lines later... 😩
Enter fullscreen mode Exit fullscreen mode

Every project starts with the same CIK lookup ritual. Then you deal with:

  • XBRL hell — financial facts buried in inline XBRL tags inside HTML, or separate XML files with namespaced taxonomies
  • Accession number formatting0000320193-24-000123 needs reformatting to build valid URLs
  • Rate limits with no clear docs — EDGAR wants custom User-Agent headers and throttles aggressively
  • Inconsistent schemas — different filers use different XBRL concepts for the same metric

There had to be a better way.


The Solution: A Ticker-First SEC EDGAR API

I built a REST API that handles all the CIK resolution, EDGAR crawling, and data normalization for you. You pass a ticker symbol. You get clean JSON.

  • Base URL: https://sec-edgar-api-0nxw.onrender.com
  • Docs: https://sec-edgar-api-0nxw.onrender.com/docs
  • Auth: Free — include an X-API-Key header (auto-registers, 100 req/day, no credit card)

Endpoints at a glance

  • GET /ticker-lookup?ticker=NVDA — resolve ticker → CIK + company name
  • GET /filings?ticker=AAPL&form_type=10-K — list recent SEC filings
  • GET /insider-trades?ticker=TSLA — Form 4 insider transaction filings
  • GET /company-facts?ticker=MSFT&concept=Revenues — XBRL financial facts by concept

Real API Responses

Let's walk through each endpoint with live data.

1. Ticker Lookup

curl -H "X-API-Key: YOUR_KEY" \
  "https://sec-edgar-api-0nxw.onrender.com/ticker-lookup?ticker=NVDA"
Enter fullscreen mode Exit fullscreen mode

Response:

{
    "ticker": "NVDA",
    "cik": "0001045810",
    "company_name": "NVIDIA CORP",
    "source": "SEC EDGAR"
}
Enter fullscreen mode Exit fullscreen mode

No manual CIK lookup. No EDGAR search pages. One call, instant CIK resolution.


2. SEC Filings by Ticker

curl -H "X-API-Key: YOUR_KEY" \
  "https://sec-edgar-api-0nxw.onrender.com/filings?ticker=AAPL&form_type=10-K"
Enter fullscreen mode Exit fullscreen mode

Response:

{
    "ticker": "AAPL",
    "company": "Apple Inc.",
    "cik": "0000320193",
    "count": 10,
    "filings": [
        {
            "form_type": "10-K",
            "filing_date": "2025-10-31",
            "accession_number": "0000320193-25-000079",
            "document_url": "https://www.sec.gov/Archives/edgar/data/320193/000032019325000079/aapl-20250927.htm"
        },
        {
            "form_type": "10-K",
            "filing_date": "2024-11-01",
            "accession_number": "0000320193-24-000123",
            "document_url": "https://www.sec.gov/Archives/edgar/data/320193/000032019324000123/aapl-20240928.htm"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

You get direct document URLs — no accession number reformatting, no index page parsing.


3. Insider Trades (Form 4)

curl -H "X-API-Key: YOUR_KEY" \
  "https://sec-edgar-api-0nxw.onrender.com/insider-trades?ticker=TSLA"
Enter fullscreen mode Exit fullscreen mode

Response:

{
    "ticker": "TSLA",
    "company": "Tesla, Inc.",
    "cik": "0001318605",
    "count": 10,
    "insider_trades": [
        {
            "form_type": "4",
            "filing_date": "2026-05-15",
            "accession_number": "0001104659-26-062860",
            "reporter": "See filing",
            "filing_url": "https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001318605&type=4"
        },
        {
            "form_type": "4",
            "filing_date": "2026-05-04",
            "accession_number": "0001104659-26-055079",
            "reporter": "See filing"
        }
    ],
    "note": "For full transaction details (shares, price, buy/sell), fetch the individual filing document.",
    "source": "SEC EDGAR Form 4"
}
Enter fullscreen mode Exit fullscreen mode

Tesla insiders filed Form 4s as recently as May 2026. This is the raw data behind every "insider selling" alert on financial news sites.


4. Company Financial Facts (XBRL)

curl -H "X-API-Key: YOUR_KEY" \
  "https://sec-edgar-api-0nxw.onrender.com/company-facts?ticker=MSFT&concept=Revenues"
Enter fullscreen mode Exit fullscreen mode

Response:

{
    "ticker": "MSFT",
    "company": "MICROSOFT CORP",
    "concept": "Revenues",
    "label": "Revenues",
    "description": "Amount of revenue recognized from goods sold, services rendered, insurance premiums, or other activities...",
    "recent_values": [
        {
            "value": 62484000000,
            "unit": "USD",
            "period_start": "2009-07-01",
            "period_end": "2010-06-30",
            "form": "10-K",
            "filed": "2010-07-30"
        },
        {
            "value": 36148000000,
            "unit": "USD",
            "period_start": "2010-07-01",
            "period_end": "2010-12-31",
            "form": "10-Q",
            "filed": "2011-01-27"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

Microsoft's revenue pulled straight from their XBRL filings — no taxonomy parsing required.


What Can You Build With This?

Stock Screeners
Pull 10-K and 10-Q filings across multiple tickers to build revenue trend screens, debt-to-equity comparisons, or custom fundamental filters.

Insider Trade Monitors
Form 4 filings are legally required within 2 business days of a transaction. Poll this endpoint on a schedule to build real-time insider activity alerts.

Compliance and Due Diligence Tools
Legal teams and investors need quick access to a company's SEC filing history. Build internal tools that surface relevant filings without manual EDGAR navigation.

Fintech Apps and Dashboards
Embed SEC filing links, revenue history, or insider activity into investor dashboards, portfolio trackers, or research platforms.

LLM / AI Research Agents
Feed filing URLs or XBRL data directly into AI pipelines for earnings analysis, risk assessment, or automated research summaries.


Python Quick Start

import requests

BASE_URL = "https://sec-edgar-api-0nxw.onrender.com"
API_KEY = "your-key-here"  # auto-registered on first use

headers = {"X-API-Key": API_KEY}

def get_filings(ticker, form_type="10-K"):
    r = requests.get(
        f"{BASE_URL}/filings",
        params={"ticker": ticker, "form_type": form_type},
        headers=headers
    )
    r.raise_for_status()
    return r.json()

def get_insider_trades(ticker):
    r = requests.get(
        f"{BASE_URL}/insider-trades",
        params={"ticker": ticker},
        headers=headers
    )
    r.raise_for_status()
    return r.json()

def get_revenue_history(ticker):
    r = requests.get(
        f"{BASE_URL}/company-facts",
        params={"ticker": ticker, "concept": "Revenues"},
        headers=headers
    )
    r.raise_for_status()
    return r.json()

# Pull Apple's 10-K filings
filings = get_filings("AAPL", "10-K")
print(f"Found {filings['count']} 10-K filings for {filings['company']}")
for f in filings["filings"][:3]:
    print(f"  {f['filing_date']}{f['document_url']}")

# Monitor Tesla insider trades
trades = get_insider_trades("TSLA")
print(f"\n{trades['count']} recent insider filings for {trades['company']}")
for t in trades["insider_trades"][:3]:
    print(f"  {t['filing_date']}{t['accession_number']}")

# Fetch Microsoft revenue data
revenue = get_revenue_history("MSFT")
print(f"\n{revenue['company']} Revenue ({revenue['concept']}):")
for v in revenue["recent_values"][:3]:
    print(f"  {v['period_end']}: ${v['value']:,.0f}")
Enter fullscreen mode Exit fullscreen mode

Resources

📊 Visualize the trends you find in SEC data with TradingView indicators: TradingView Tools

🛠️ Browse my recommended developer tools: Amazon Developer Picks


Get Started

Your X-API-Key auto-registers on first use — just pick a key name and start querying.


Have a use case in mind? Drop it in the comments — I'd love to hear what you're building with public financial data.


Get weekly AI business & automation insights → AI Business Trends on Substack

Top comments (0)