This API provides access to SEC Form 4 filings (insider transactions) for all S&P 500 companies. All data is updated daily through automated GitHub Actions workflows.
Form 4 is an SEC filing that reports transactions by insiders (officers, directors, and significant shareholders) in their company's stock. These are legal transactions that must be reported to the SEC and made public, typically within two business days of the transaction.
GET /data/json/companies.json
Returns a list of all companies with metadata including the number of transactions and date ranges.
{
"last_updated": "2025-04-15T10:30:45.123456",
"count": 20,
"companies": [
{
"ticker": "AAPL",
"name": "Apple Inc.",
"transaction_count": 42,
"latest_transaction": "2025-04-10",
"earliest_transaction": "2024-10-15"
},
...
]
}
GET /data/json/{ticker}/transactions.json
Returns comprehensive Form 4 filing data for the specified company. This endpoint provides a complete dataset that can be filtered client-side.
{
"ticker": "AAPL",
"last_updated": "2025-04-15T10:30:45.123456",
"count": 120,
"transactions": [
{
"id": 123,
"issuer_name": "Apple Inc.",
"reporting_owner": "Cook, Tim",
"reporting_owner_cik": "0001214156",
"reporting_owner_position": "Chief Executive Officer",
"transaction_date": "2025-04-10",
"transaction_shares": "10000",
"transaction_price": "180.25",
"transaction_type": "S",
"shares_after_transaction": "845000"
},
...
]
}
You can implement filtering on your side using these parameters:
GET /data/json/{ticker}/quarterly/{YYYY-Q#}.json
Returns Form 4 filings for a specific quarter. For example: AAPL/quarterly/2024-Q2.json
{
"ticker": "AAPL",
"year": 2024,
"quarter": 2,
"last_updated": "2025-04-15T10:30:45.123456",
"count": 35,
"transactions": [
{
"id": 123,
"issuer_name": "Apple Inc.",
"reporting_owner": "Cook, Tim",
"reporting_owner_cik": "0001214156",
"reporting_owner_position": "Chief Executive Officer",
"transaction_date": "2024-06-15",
"transaction_shares": "10000",
"transaction_price": "180.25",
"transaction_type": "S",
"shares_after_transaction": "845000"
},
...
]
}
GET /data/json/summary.json
Returns summary data including the largest transactions by value and the most recent transactions across all companies.
{
"last_updated": "2025-04-15T10:30:45.123456",
"large_transactions": [
{
"ticker": "MSFT",
"company": "Microsoft Corporation",
"insider": "Nadella, Satya",
"position": "Chief Executive Officer",
"date": "2025-03-15",
"shares": "50000",
"price": "420.75",
"type": "S",
"value": 21037500
},
...
],
"recent_transactions": [
...
]
}
The SEC Form 4 uses specific codes to indicate the type of transaction being reported:
Code | Description | Details |
---|---|---|
P | Open market or private purchase | The insider bought shares on the open market |
S | Open market or private sale | The insider sold shares on the open market |
A | Grant or award | The insider received shares from the company, often as compensation |
M | Exercise of options/conversion of derivative | The insider exercised options to acquire shares |
G | Gift | The insider gave or received shares as a gift |
D | Disposition to the issuer | The insider sold or returned shares to the company |
F | Payment of exercise price or tax liability | Shares surrendered to pay for options or taxes |
J | Other acquisition or disposition | Transactions not covered by other codes |
// Fetch transactions for Apple and apply filters
fetch('https://kenny-hk.github.io/sec-form4-api/data/json/AAPL/transactions.json')
.then(response => response.json())
.then(data => {
// Filter by date range (last year)
const oneYearAgo = new Date();
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
// Filter by transaction type (sales only) and date
const salesOnly = data.transactions.filter(tx => {
const txDate = new Date(tx.transaction_date);
return tx.transaction_type === 'S' && txDate >= oneYearAgo;
});
console.log(`Found ${salesOnly.length} sales transactions in the last year`);
// Calculate total shares sold
const totalShares = salesOnly.reduce((sum, tx) => {
return sum + (parseFloat(tx.transaction_shares) || 0);
}, 0);
console.log(`Total shares sold: ${totalShares.toLocaleString()}`);
});
import requests
import pandas as pd
from datetime import datetime, timedelta
# Fetch all transactions for Apple
response = requests.get('https://kenny-hk.github.io/sec-form4-api/data/json/AAPL/transactions.json')
data = response.json()
# Convert to DataFrame for easy filtering
df = pd.DataFrame(data['transactions'])
# Client-side filtering examples
# 1. Filter by date range (last 6 months)
six_months_ago = (datetime.now() - timedelta(days=180)).strftime('%Y-%m-%d')
recent_df = df[df['transaction_date'] >= six_months_ago]
# 2. Filter by transaction type (only sales and purchases)
sales_purchases = df[df['transaction_type'].isin(['S', 'P'])]
# 3. Filter by specific executive role
ceo_transactions = df[df['reporting_owner_position'].str.contains('CEO', na=False)]
# 4. Find largest transactions by value
df['value'] = df['transaction_shares'].astype(float) * df['transaction_price'].astype(float)
largest_transactions = df.sort_values('value', ascending=False).head(10)
print(f"Found {len(df)} total transactions for {data['ticker']}")
print(f"Transactions in last 6 months: {len(recent_df)}")
print(f"Sales and purchases: {len(sales_purchases)}")
print(f"CEO transactions: {len(ceo_transactions)}")
print(f"Largest transaction value: ${largest_transactions.iloc[0]['value']:,.2f}")
The Form 4 data is updated daily at 8:00 UTC through an automated GitHub Actions workflow. Each update fetches the latest Form 4 filings from the SEC EDGAR database for all S&P 500 companies.
To optimize storage and performance, we implement the following data retention policy:
This API is built and maintained as an open-source project. The source code is available on GitHub: https://github.com/kenny-hk/sec-form4-api