# SEC Form 4 Insider Trading Scraper & XML Parser API (`mehdad-datalabs/sec-form-4-insider-trading-scraper-xml-parser-api`) Actor

Extract real-time SEC EDGAR Form 4 insider trading filings and parse raw XML into clean JSON, CSV, or Excel. Track CEO, CFO, Director & 10% Owner open-market stock purchases (P) and sales (S), exact share counts, prices, and total dollar values. Built for n8n, Make & MCP AI agents.

- **URL**: https://apify.com/mehdad-datalabs/sec-form-4-insider-trading-scraper-xml-parser-api.md
- **Developed by:** [Mehdad Sharifi](https://apify.com/mehdad-datalabs) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 extracted insider transactions

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SEC Form 4 Insider Trading Scraper & XML Parser API (Exact Shares, Price & Dollar Value)

Extract real-time SEC EDGAR Form 4 insider trading transactions directly into clean JSON, CSV, or Excel datasets. Unlike basic index scrapers that only give you a link to a messy SEC filing, this Actor parses the raw Form 4 XML to deliver exact Insider Names, Executive Titles (CEO, CFO, Director, 10% Owner), Transaction Codes (P Buy / S Sell), Share Counts, Share Prices, Total Dollar Values ($), and Post-Trade Holdings.

Built for algorithmic traders, financial newsletters, hedge fund analysts, n8n and Make automation workflows, and AI agents (Claude MCP / Cursor)—with zero SEC API keys or residential proxies required.

***

### Why Choose This SEC Form 4 Insider Trading Scraper?

| Feature | What You Get |
| :--- | :--- |
| Deep XML Transaction Parsing | Automatically strips SEC XSLT wrappers and parses raw XML nonDerivativeTransaction and derivativeTransaction nodes into flat, ready-to-use rows. |
| Calculated Dollar Value Filter | Filter out tiny administrative trades and extract only high-conviction insider buys (e.g., minDollarValue: $50,000+). |
| Open Market Buy/Sell Filtering | Isolate genuine open-market purchases (P) and sales (S) from routine stock awards (A) or tax withholdings (F) with one click. |
| Zero Proxy or API Key Costs | Connects directly to official SEC EDGAR endpoints with compliant rate-limiting—keeping your run costs near zero. |
| AI Agent & MCP Server Ready | Plug directly into Claude Desktop, Cursor, LangChain, n8n, Make, or Zapier for automated daily C-suite cluster-buy alerts. |

***

### What Data Does This Actor Extract? (Sample JSON Output)

Every insider trade inside a Form 4 filing is flattened into its own structured record:

```
{
  "ticker": "NVDA",
  "companyName": "NVIDIA CORP",
  "cik": "0001045810",
  "filingDate": "2026-10-28",
  "transactionDate": "2026-10-26",
  "insiderName": "HUANG JEN HSUN",
  "insiderRole": "President and CEO, Director",
  "insiderCik": "0001197649",
  "isOfficer": true,
  "isDirector": true,
  "isTenPercentOwner": false,
  "securityType": "Common Stock",
  "isDerivative": false,
  "transactionCode": "P",
  "transactionLabel": "Open Market Purchase",
  "acquiredOrDisposed": "Acquired (Buy/Add)",
  "shares": 25000.0,
  "pricePerShare": 138.5,
  "totalDollarValue": 3462500.0,
  "sharesOwnedAfterTrade": 75420000.0,
  "ownershipType": "Direct",
  "accessionNumber": "0001045810-26-000142",
  "rawXmlUrl": "https://www.sec.gov/Archives/edgar/data/1045810/000104581026000142/form4.xml",
  "humanFilingUrl": "https://www.sec.gov/Archives/edgar/data/1045810/000104581026000142/xslF345X05/form4.xml"
}
```

***

### How to Use SEC Form 4 Insider Trading Scraper

1. Enter Stock Tickers: Add one or more US stock tickers (e.g., NVDA, AAPL, TSLA, PLTR). The Actor resolves tickers to 10-digit SEC Central Index Keys (CIKs) automatically.
2. Choose Transaction Codes: Keep the default \["P", "S"] to focus purely on open-market cash purchases and sales, or clear the list to capture all 20 SEC transaction codes (including M option exercises and A grants).
3. Set Minimum Dollar Value: Optional—set minDollarValue (for example, 100000) to capture only trades worth $100,000 or more.
4. Run & Export: Click Start and download your data in JSON, CSV, Excel, or XML, or pull it automatically via the Apify REST API.

***

### SEC Form 4 Transaction Codes Reference

| Code | Meaning | Signal Strength for Traders |
| :--- | :--- | :--- |
| P | Open Market Purchase | Highest Bullish Signal — Insider spent personal cash to buy shares on the open market. |
| S | Open Market Sale | Bearish / Liquidity Signal — Insider sold shares on the open market for cash. |
| M | Option Exercise | Moderate — Insider converted stock options into shares. |
| A | Grant or Award | Neutral — Routine executive compensation package. |
| F | Tax Withholding | Neutral — Shares surrendered automatically to pay tax on vesting awards. |

***

### Transparent Pay-Per-Event Pricing

You only pay for the exact filtered insider transactions that match your criteria:

- Actor Startup (apify-actor-start): $0.01 per run.
- Extracted Transaction (transaction-extracted): $0.005 per parsed insider trade ($5.00 per 1,000 transactions).
- Free Tier Friendly: With Apify's free $5.00 monthly credit, you can extract nearly 1,000 parsed insider trades every month for free.

***

### Top Use Cases

- Insider Cluster-Buy Alert Bots: Connect this Actor to n8n, Make, or Telegram and Discord webhooks to alert your trading community within minutes when 3+ executives buy shares in the same company.
- Quantitative Alpha Models: Backtest and feed live C-suite net buy/sell dollar ratios into Python trading strategies.
- Financial Newsletter Automation: Automatically generate "Top 10 CEO Stock Buys of the Week" tables for Substack or Beehiiv subscribers.
- AI Financial Research Agents (MCP): Give Claude Desktop or Cursor live access to verified SEC Form 4 ownership filings via Apify's Model Context Protocol (MCP) server.

***

### Frequently Asked Questions (FAQ)

#### What is SEC Form 4 Insider Trading?

SEC Form 4 (Statement of Changes in Beneficial Ownership) is a mandatory filing with the U.S. Securities and Exchange Commission whenever a company insider—such as a CEO, CFO, corporate officer, board director, or 10%+ beneficial shareholder—buys or sells shares in their own company. Insiders must file Form 4 within two business days of the transaction.

#### Why filter for Transaction Code P (Open Market Purchase)?

Most raw Form 4 filings are routine stock grants (Code A), option exercises (Code M), or tax withholdings (Code F). Transaction Code P isolates genuine Open Market Purchases where an executive spent their own personal cash to buy stock at current market prices—widely considered the strongest bullish insider signal in quantitative finance.

#### How can I connect this SEC Form 4 API to Python, Google Sheets, or n8n?

You can trigger this Actor via the official Apify REST API, the apify-client Python or JavaScript SDK, or the native Apify integration node inside n8n, Make, and Zapier to stream parsed insider trades directly into Google Sheets, Slack, Telegram, or PostgreSQL.

***

### Explore Our Complete SEC EDGAR & B2B Intelligence API Suite

- [SEC Form 13F Institutional Holdings & Hedge Fund Whale Scraper](https://apify.com/mehdad-datalabs/sec-13f-institutional-holdings-hedge-fund-whale-scraper) — Track Warren Buffett (Berkshire Hathaway), Michael Burry & hedge fund portfolios.
- [SEC Form N-PORT Mutual Fund & ETF Portfolio Holdings API](https://apify.com/mehdad-datalabs/sec-nport-etf-mutual-fund-holdings-xml-scraper) — Extract monthly ETF & Mutual Fund equity/bond holdings, CUSIPs, ISINs & net asset weights %.
- [SEC 10-K & 10-Q XBRL Financial Statements & Earnings API](https://apify.com/mehdad-datalabs/sec-10k-10q-xbrl-financial-statements-earnings-api) — Standardized quarterly & annual Revenue, Net Income, EPS, Cash & Balance Sheets.
- [SEC Form 8-K Corporate Events, M\&A & Executive Change Scraper](https://apify.com/mehdad-datalabs/sec-8k-corporate-events-ma-executive-change-scraper) — Real-time M\&A deals, earnings releases & Item 5.02 CEO changes.
- [SEC Schedule 13D & 13G Activist Investor & 5%+ Ownership API](https://apify.com/mehdad-datalabs/sec-schedule-13d-13g-activist-investor-ownership-api) — Track hostile takeovers and 5%+ activist hedge fund stakes.
- [SEC Form S-1 IPO Pipeline & Form 144 Insider Sale Notice API](https://apify.com/mehdad-datalabs/sec-ipo-s1-form144-insider-sale-scraper) — Track S-1 IPO registrations and Rule 144 restricted stock dumps.
- [SEC Form D Startup Funding, VC Raise & Founder B2B Lead API](https://apify.com/mehdad-datalabs/sec-form-d-startup-funding-vc-b2b-lead-scraper) — Newly funded startups, dollar amounts raised & Founder/CEO contact info.
- [US Federal Government Contract Awards & DoD B2B Lead Scraper](https://apify.com/mehdad-datalabs/us-federal-government-contract-awards-dod-b2b-scraper) — Pentagon & federal contract awards by keyword or company.
- [FDA Drug Approvals, NDA/BLA Biotech Catalyst & Pharma API](https://apify.com/mehdad-datalabs/fda-drug-approvals-biotech-catalyst-pharma-b2b-scraper) — Official US FDA drug approvals & biotech stock catalysts.
- [ClinicalTrials.gov Phase 1-3 Biotech Catalyst & B2B Lead API](https://apify.com/mehdad-datalabs/clinical-trials-biotech-catalyst-cro-b2b-lead-scraper) — Phase 1-3 clinical trials, completion readout dates & study contacts.
- [US Doctor, Dentist & Medical Clinic B2B Lead Scraper API](https://apify.com/mehdad-datalabs/us-doctor-dentist-clinic-healthcare-b2b-lead-scraper) — Verified US doctors, dentists & clinic owner direct phone numbers.

# Actor input Schema

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

Enter stock ticker symbols to extract parsed insider transactions.

## `transactionCodes` (type: `array`):

Filter specific SEC trade codes: 'P' = Open Market Purchase, 'S' = Open Market Sale, 'A' = Grant/Award, 'M' = Option Exercise. Leave empty to extract all codes.

## `minDollarValue` (type: `integer`):

Only return insider transactions where Total Dollar Value (Shares x Price) is greater than or equal to this amount.

## `maxFilingsPerTicker` (type: `integer`):

Maximum number of recent Form 4 XML filings to parse per ticker.

## Actor input object example

```json
{
  "tickers": [
    "NVDA",
    "AAPL",
    "TSLA"
  ],
  "transactionCodes": [
    "P",
    "S"
  ],
  "minDollarValue": 0,
  "maxFilingsPerTicker": 15
}
```

# Actor output Schema

## `dataset` (type: `string`):

Clean table of parsed SEC Form 4 insider trading transactions

# 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("mehdad-datalabs/sec-form-4-insider-trading-scraper-xml-parser-api").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("mehdad-datalabs/sec-form-4-insider-trading-scraper-xml-parser-api").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 mehdad-datalabs/sec-form-4-insider-trading-scraper-xml-parser-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mehdad-datalabs/sec-form-4-insider-trading-scraper-xml-parser-api"
        }
    }
}
```

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/CIPqtvefSxBTTpo15/builds/6hhgsY9eTALmXwve6/openapi.json
