# US SEC EDGAR Filings Scraper (`ivosandoval/us-sec-edgar-scraper`) Actor

Scrape SEC EDGAR filings (10-K, 10-Q, 8-K, Form 4) for any US public company. Search by ticker, CIK, or company name. Optional XBRL enrichment extracts revenue, net income, total assets, and EPS. Fully compliant with SEC rate limits. Output as JSON.

- **URL**: https://apify.com/ivosandoval/us-sec-edgar-scraper.md
- **Developed by:** [Ivo Sandoval](https://apify.com/ivosandoval) (community)
- **Categories:** Automation, Lead generation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## US SEC EDGAR Filings Scraper

Apify Actor that scrapes SEC EDGAR filings for US public companies. Supports
10-K (annual), 10-Q (quarterly), 8-K (current events), Form 4 (insider trading),
13F-HR (institutional holdings), 13D/13G (activist stakes), and any other SEC form type.

### Features

- **Search by ticker, CIK, or company name**
- **XBRL financial data enrichment** (revenue, net income, total assets, EPS)
- **Form 4 insider trades** (owner, relationship, transactions with shares/price)
- **13F institutional holdings** (top 50 positions with CUSIP, value, shares)
- **8-K item parsing** (extracted item codes and titles)
- **AI summaries** (optional, powered by OpenAI gpt-4o-mini)
- **PostgreSQL persistence** with upsert by accession number
- **Rate-limited** to comply with SEC's 10 req/s policy

### Data source

SEC EDGAR (https://www.sec.gov/edgar) -- fully public, no API key required.

SEC requires a `User-Agent` header with contact info. Set via `SEC_USER_AGENT`
env var or defaults to `datamon/1.0 (datamon@example.com)`.

### Usage

#### Local runner

```bash
cd actors/us-sec-edgar
pip install -r requirements.txt

## Basic: search by ticker (no database)
python runner.py --no-db --ticker AAPL --form-types 10-K --max-results 5

## XBRL financial data
python runner.py --no-db --ticker TSLA --form-types 10-K,10-Q --include-xbrl --max-results 3

## Form 4 insider trades
python runner.py --no-db --ticker AAPL --form-types 4 --include-form-data --max-results 5

## 13F institutional holdings (Berkshire Hathaway)
python runner.py --no-db --cik 0001067983 --form-types 13F-HR --include-form-data --max-results 2

## 8-K with parsed items
python runner.py --no-db --ticker AAPL --form-types 8-K --include-form-data --max-results 3

## AI summaries (requires OPENAI_API_KEY)
OPENAI_API_KEY=sk-... python runner.py --no-db --ticker AAPL --form-types 10-K --include-ai-summary --max-results 1

## All enrichments combined
python runner.py --no-db --ticker AAPL --form-types 10-K,10-Q,8-K,4 \
    --include-xbrl --include-form-data --max-results 10

## Search by company name
python runner.py --no-db --search-query "Microsoft" --form-types 10-K --max-results 10

## With database persistence
DATABASE_URL="postgresql+asyncpg://datamon:pass@host:5432/datamon_us_sec_edgar" \
    python runner.py --ticker AAPL --form-types 10-K --max-results 50
```

#### Apify run

```json
{
    "ticker": "AAPL",
    "form_types": ["10-K", "4", "8-K"],
    "date_from": "2024-01-01",
    "date_to": "2025-12-31",
    "include_xbrl": true,
    "include_form_data": true,
    "include_ai_summary": false,
    "max_results": 50
}
```

```bash
apify run --purge
```

### Example output

#### 10-K with XBRL

```json
{
    "cik": "0000320193",
    "company_name": "Apple Inc.",
    "ticker": "AAPL",
    "form_type": "10-K",
    "filing_date": "2024-11-01",
    "accession_number": "0000320193-24-000123",
    "filing_url": "https://www.sec.gov/Archives/edgar/data/320193/...",
    "revenue": 394328000000,
    "net_income": 99803000000,
    "total_assets": 352583000000,
    "eps_basic": 6.15
}
```

#### Form 4 (insider trade)

```json
{
    "form_type": "4",
    "insider_data": {
        "owner_name": "WILLIAMS JEFFREY E",
        "owner_cik": "0001214128",
        "is_director": false,
        "is_officer": true,
        "officer_title": "Chief Operating Officer",
        "transactions": [
            {
                "date": "2024-04-01",
                "type": "S",
                "type_label": "Sale",
                "shares": 100000,
                "price_per_share": 170.50,
                "shares_after": 489944,
                "security_title": "Common Stock"
            }
        ]
    }
}
```

#### 13F (institutional holdings)

```json
{
    "form_type": "13F-HR",
    "holdings_data": {
        "total_value": 347691992000,
        "total_holdings": 41,
        "top_holdings": [
            {
                "issuer": "APPLE INC",
                "cusip": "037833100",
                "value": 91200000000,
                "shares": 400000000,
                "share_type": "SH"
            }
        ]
    }
}
```

#### 8-K (current report items)

```json
{
    "form_type": "8-K",
    "items_data": {
        "items": [
            {"code": "2.02", "title": "Results of Operations and Financial Condition"},
            {"code": "9.01", "title": "Financial Statements and Exhibits"}
        ]
    }
}
```

### Database

- **Database**: `datamon_us_sec_edgar`
- **Table**: `filings`
- **Upsert key**: `accession_number` (unique per filing across all of EDGAR)

### Environment variables

| Variable | Required | Description |
|----------|----------|-------------|
| `SEC_USER_AGENT` | Recommended | User-Agent for SEC requests |
| `DATABASE_URL` | For persistence | PostgreSQL connection string |
| `OPENAI_API_KEY` | For AI summaries | OpenAI API key |

### Pricing

$0.40 / 1,000 results

# Actor input Schema

## `search_query` (type: `string`):

Company name or keyword to search in EDGAR (e.g. 'Apple', 'Tesla Motors')

## `ticker` (type: `string`):

Stock ticker symbol (e.g. AAPL, TSLA, MSFT, GOOGL)

## `cik` (type: `string`):

SEC Central Index Key (e.g. 0000320193 for Apple). Will be zero-padded automatically.

## `form_types` (type: `array`):

Filing form types to fetch. Common: 10-K (annual), 10-Q (quarterly), 8-K (current events), 4 (insider trading)

## `date_from` (type: `string`):

Start date for filing search (YYYY-MM-DD)

## `date_to` (type: `string`):

End date for filing search (YYYY-MM-DD)

## `include_xbrl` (type: `boolean`):

Fetch structured financial data (revenue, net income, total assets, EPS) for 10-K and 10-Q filings via XBRL API

## `include_form_data` (type: `boolean`):

Parse form documents: Form 4 insider trades (owner, transactions), 13F institutional holdings (top 50 positions), 8-K item sections

## `include_ai_summary` (type: `boolean`):

Generate AI-powered 2-3 sentence summary of each filing. Requires OpenAI API key (set below or via OPENAI\_API\_KEY env var)

## `openai_api_key` (type: `string`):

Your OpenAI API key. Only needed if 'Include AI Summary' is enabled. Alternatively set OPENAI\_API\_KEY environment variable.

## `max_results` (type: `integer`):

Maximum number of filings to return

## `database_url` (type: `string`):

PostgreSQL connection string to persist results. Format: postgresql+asyncpg://user:pass@host:port/dbname

## `proxy_configuration` (type: `object`):

Apify proxy configuration

## Actor input object example

```json
{
  "form_types": [
    "10-K",
    "10-Q",
    "8-K"
  ],
  "include_xbrl": false,
  "include_form_data": false,
  "include_ai_summary": false,
  "max_results": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("ivosandoval/us-sec-edgar-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("ivosandoval/us-sec-edgar-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call ivosandoval/us-sec-edgar-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ivosandoval/us-sec-edgar-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1yg2D47awrzMDCcBW/builds/unZqJ65YHcibRzeSo/openapi.json
