# SEC Form 4 Insider Trading Scraper — EDGAR to JSON (`lilm/sec-form4-insider-trading-scraper`) Actor

Fetches recent SEC Form 4 insider-trading filings from EDGAR for a list of tickers or CIKs and outputs clean, normalized, machine-verified transaction records (insider buys/sells, role, shares, price, value).

- **URL**: https://apify.com/lilm/sec-form4-insider-trading-scraper.md
- **Developed by:** [lilm](https://apify.com/lilm) (community)
- **Categories:** Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## SEC Form 4 Insider Trading Scraper — EDGAR to clean JSON

**Track insider buys and sells straight from SEC EDGAR, as clean JSON or CSV.** Give it stock
tickers (or CIK numbers); get back a normalized, machine-verified table of every Form 4 insider
transaction — who traded, their role, how many shares, at what price, and the computed value.

Corporate insiders — directors, officers, and 10%+ owners — must report every trade in their own
company's stock to the SEC on **Form 4**, usually within two business days. That filing stream is one
of the most-watched signals in equity research. But EDGAR publishes it as raw XML scattered across
thousands of archive folders, which is painful to parse correctly. This actor turns that firehose
into a clean dataset you can actually use.

### Why use this SEC Form 4 scraper

- **Official, public-domain source.** Reads directly from the SEC EDGAR submissions and Archives
  APIs. The underlying data is U.S. government public domain — no third-party data vendor, no license
  restrictions, no scraping of a site behind authentication.
- **Machine-verified parsing — correctness is the product.** Insider-trade data is worthless if the
  numbers are wrong. Every release is checked by an **independent second parser** (a separate code
  path) that re-extracts each field from real filings and diffs them field-by-field, plus sanity
  assertions: transaction codes are valid SEC codes, dates parse, and `value = shares × price`.
- **Clean, normalized schema.** One flat record per transaction — ready for a spreadsheet, a
  database, or a dashboard with zero post-processing.
- **Honest handling of missing data.** When a filing omits the price (footnote-only),
  `price_per_share` is `null` — never invented. When the SEC reports an explicit `0` (common for
  gifts and certain awards), it is passed through faithfully as filed.
- **Derivative transactions included.** Options, RSUs, and other Table II events come through as
  separate records (`record_type: "derivative"`), or you can turn them off.
- **Polite to the SEC.** Identifying User-Agent, rate-limited requests, and automatic backoff so runs
  stay within EDGAR's fair-access guidelines.

### Quick start

1. Enter one or more **tickers** (e.g. `AAPL`, `MSFT`, `NVDA`) — or **CIK** numbers for companies
   without a clean ticker match.
2. Set the **lookback window** in days (default 14).
3. Run it. Results land in the dataset, exportable as JSON, CSV, or Excel, or readable via the
   Apify API for your own pipeline.

### Input

| Field | Meaning |
|---|---|
| `tickers` | Stock tickers to scan (e.g. `AAPL`). Resolved to CIK via SEC's official `company_tickers.json`. |
| `ciks` | SEC Central Index Keys to scan directly (for companies without a ticker match). |
| `days` | Lookback window in days (default 14). |
| `maxFilingsPerCompany` | Optional cap on filings per company (newest first). |
| `includeDerivatives` | Include Table II derivative transactions (default true). |
| `userAgent` | Contact string sent to the SEC on every request (SEC requires this). |

### Output schema

One record per insider transaction:

| Field | Description |
|---|---|
| `record_type` | `non_derivative` or `derivative` |
| `issuer_name`, `issuer_ticker`, `issuer_cik` | The company |
| `owner_name`, `owner_cik` | The insider |
| `owner_relationship` | director / officer (+ title) / 10% owner |
| `transaction_date`, `filing_date` | When it happened / was filed |
| `transaction_code` | P = open-market buy, S = sale, A = award, G = gift, M = option exercise, F = tax, … |
| `shares`, `price_per_share`, `transaction_value` | Size, price (null if not disclosed), shares × price |
| `acquired_disposed` | A (acquired) or D (disposed) |
| `shares_owned_after` | Holdings after the transaction |
| `ownership`, `ownership_nature` | Direct (D) or indirect (I), plus nature if given |
| `security_title`, `accession_number`, `source_url` | Security, SEC accession, link to the filing |

```json
{
  "record_type": "non_derivative",
  "issuer_name": "NVIDIA CORP",
  "issuer_ticker": "NVDA",
  "owner_name": "Neal Stephen C",
  "owner_relationship": "director",
  "transaction_date": "2026-06-04",
  "transaction_code": "S",
  "shares": 15500,
  "price_per_share": 215.7331,
  "acquired_disposed": "D",
  "shares_owned_after": 0,
  "ownership": "I",
  "transaction_value": 3343863.05,
  "source_url": "https://www.sec.gov/Archives/edgar/data/1045810/.../form4.xml"
}
````

### Use cases

- **Insider-trading signals** — flag clusters of open-market buys (code `P`) by multiple officers, a
  classic conviction signal, versus routine `S`/`F` sales.
- **Portfolio monitoring** — run it on the tickers you hold and pipe new Form 4s into a Slack/email
  alert via Apify integrations or webhooks.
- **Newsletters & dashboards** — power an "insider activity this week" section with structured data
  instead of hand-copying from EDGAR.
- **Quant & academic research** — build a reproducible insider-transaction dataset across many
  tickers and date ranges.
- **Compliance & diligence** — monitor insider activity at companies you cover.

### How it works

The actor resolves each ticker to its SEC CIK, pulls the company's recent submissions, filters to
Form 4 (and 4/A is excluded so you only get original filings), fetches each ownership XML document,
and parses both non-derivative (Table I) and derivative (Table II) transactions into flat records.
Every run is parsed twice by two independent code paths and the outputs are diffed, so a silent
parsing regression can't ship.

### FAQ

**Is this an insider-trading API?** It's an actor you run on demand (or on a schedule) that returns
the same data an API would. You can call it via the Apify API and read results programmatically, so
it works as a free SEC Form 4 / insider-trading API for your app or notebook.

**Where does the data come from?** Exclusively from SEC EDGAR — the official U.S. government filing
system. The data is public domain; this tool just fetches and structures it.

**How fresh is it?** As fresh as EDGAR. Insiders typically file Form 4 within two business days of a
trade; the actor returns filings as soon as they're on EDGAR.

**Can I get insider trades for many companies at once?** Yes — pass a list of tickers and/or CIKs and
a lookback window; results come back combined in one dataset.

**Does it cover 13F or 13D/G?** Not yet — this actor is focused on Form 4 insider transactions.
13F institutional holdings is a planned companion.

**Is the price ever wrong or zero?** Prices are taken as filed. Some events (gifts, certain awards)
legitimately have a `0` or no price; those are passed through honestly rather than guessed.

**Is this investment advice?** No. It reports public filings as filed.

### Notes & limitations

- Form 4/A **amendments are not merged**; records reflect original filings as filed.
- Multiple reporting owners on one filing are combined into a single owner string.
- Very long lookbacks on extremely active filers are bounded by EDGAR's recent-submissions window.

***

*Data source: U.S. Securities and Exchange Commission EDGAR (public domain). Not affiliated with or
endorsed by the SEC. Reports filings as filed; not investment advice.*

# Actor input Schema

## `tickers` (type: `array`):

Stock tickers to scan (e.g. AAPL). Resolved to CIK via SEC's official company\_tickers.json. Provide tickers, CIKs, or both.

## `ciks` (type: `array`):

SEC Central Index Keys to scan directly (e.g. 320193). Useful for companies without a ticker match.

## `days` (type: `integer`):

How many days back to fetch Form 4 filings.

## `maxFilingsPerCompany` (type: `integer`):

Optional cap on Form 4 filings fetched per company (newest first).

## `includeDerivatives` (type: `boolean`):

Also push derivative transactions (options, RSUs) as records with record\_type='derivative'.

## `userAgent` (type: `string`):

SEC requires a User-Agent identifying you with contact info on every EDGAR request. Format: 'Company/Project contact@email.com'.

## Actor input object example

```json
{
  "tickers": [
    "AAPL",
    "MSFT",
    "NVDA"
  ],
  "days": 14,
  "includeDerivatives": true,
  "userAgent": "MoneyMakerResearch admin@example.com"
}
```

# 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 = {
    "tickers": [
        "AAPL",
        "MSFT",
        "NVDA"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("lilm/sec-form4-insider-trading-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 = { "tickers": [
        "AAPL",
        "MSFT",
        "NVDA",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("lilm/sec-form4-insider-trading-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "tickers": [
    "AAPL",
    "MSFT",
    "NVDA"
  ]
}' |
apify call lilm/sec-form4-insider-trading-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lilm/sec-form4-insider-trading-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "SEC Form 4 Insider Trading Scraper — EDGAR to JSON",
        "description": "Fetches recent SEC Form 4 insider-trading filings from EDGAR for a list of tickers or CIKs and outputs clean, normalized, machine-verified transaction records (insider buys/sells, role, shares, price, value).",
        "version": "0.1",
        "x-build-id": "Pb2HSyogr5BhtHxIB"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/lilm~sec-form4-insider-trading-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-lilm-sec-form4-insider-trading-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/lilm~sec-form4-insider-trading-scraper/runs": {
            "post": {
                "operationId": "runs-sync-lilm-sec-form4-insider-trading-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/lilm~sec-form4-insider-trading-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-lilm-sec-form4-insider-trading-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "tickers": {
                        "title": "Tickers",
                        "type": "array",
                        "description": "Stock tickers to scan (e.g. AAPL). Resolved to CIK via SEC's official company_tickers.json. Provide tickers, CIKs, or both.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "ciks": {
                        "title": "CIK numbers",
                        "type": "array",
                        "description": "SEC Central Index Keys to scan directly (e.g. 320193). Useful for companies without a ticker match.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "days": {
                        "title": "Lookback window (days)",
                        "minimum": 1,
                        "maximum": 365,
                        "type": "integer",
                        "description": "How many days back to fetch Form 4 filings.",
                        "default": 14
                    },
                    "maxFilingsPerCompany": {
                        "title": "Max filings per company",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Optional cap on Form 4 filings fetched per company (newest first)."
                    },
                    "includeDerivatives": {
                        "title": "Include derivative transactions (Table II)",
                        "type": "boolean",
                        "description": "Also push derivative transactions (options, RSUs) as records with record_type='derivative'.",
                        "default": true
                    },
                    "userAgent": {
                        "title": "SEC User-Agent contact",
                        "type": "string",
                        "description": "SEC requires a User-Agent identifying you with contact info on every EDGAR request. Format: 'Company/Project contact@email.com'.",
                        "default": "MoneyMakerResearch admin@example.com"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
