SEC EDGAR API for Form 4: insider trading filings as JSON (2026)
When a CEO buys their own stock with their own cash, they have to tell you. Within two business days.
That disclosure is the Form 4, and it is the closest thing the market has to a real-time insider feed. Congress made it fast on purpose.
But there is a trap. Most of what lands on a Form 4 is not a decision at all. It is a paycheck. Here is how to pull Form 4 as clean JSON, decode the transaction codes, and tell the one row that matters from the noise around it.
GET /v1/insider/{ticker}, each transaction tagged buy, sell, or neutral, with pre-scheduled 10b5-1 sales flagged.What is a Form 4 filing?
A Form 4 is the report a corporate insider files when they trade their own company's stock. Under Section 16 of the Securities Exchange Act, directors, officers, and anyone owning more than 10 percent of a company must disclose the trade within two business days, per the SEC's Forms 3, 4, and 5 rules. It is the fastest public signal of what the people running a company do with their own money.
Two business days is quick, and it was not always the rule.
Before the Sarbanes-Oxley Act of 2002, an insider could wait until the tenth day of the month after a trade. A purchase on the first of the month might stay hidden for almost six weeks. Sarbanes-Oxley cut that to two business days, which is why Form 4 is the near-real-time feed it is today.
Form 4 has two siblings. Form 3 is the initial statement an insider files within ten days of taking the role, and Form 5 is an annual cleanup for small or deferred transactions, due 45 days after the fiscal year ends, per Investor.gov.
The scale is large. One vendor, sec-api.io, counts 11.4 million insider transactions from 277,000 unique insiders in the EDGAR ownership record.
What do the Form 4 transaction codes mean?
Every trade on a Form 4 carries a one-letter transaction code, and the code is the whole story. Code P is an open-market purchase and code S is an open-market sale, the two where the insider chose to act. Code A is a stock grant, M is an option exercise, and F is shares withheld to pay tax, all compensation on a schedule rather than a market call, per InsiderBrief's code reference.
This is the part that trips up every first-time parser.
You pull a company's Form 4s, see a wall of transactions, and read activity as conviction. It is not. Code F, tax withholding on vesting shares, is the most common code you will ever see, and it says nothing about what the insider believes.
The filing splits into two tables. Table I is non-derivative securities, meaning common stock. Table II is derivatives, meaning options, warrants, and convertibles. The same codes apply to both, so a P in Table I is a stock purchase and an A in Table II is an option grant.
| Code | Meaning | What it signals |
|---|---|---|
| P | Open-market purchase | Buy. Own money, at the market price. |
| S | Open-market sale | Sell. Read with care, see 10b5-1 below. |
| A | Grant or award | Neutral. Compensation, not a choice. |
| M | Option exercise or conversion | Neutral. Often paired with a sale. |
| F | Shares withheld for tax | Neutral. Automatic on vesting. |
| G | Gift | Neutral. |
How do you get Form 4 data as JSON?
The fastest path is a hosted endpoint that parses the ownership XML for you. With Edgrapi that is GET /v1/insider/{ticker}: pass a ticker and you get each insider's recent filings back as JSON, with the owner, their role, the transaction code and its plain-English label, share count, price, computed value, and a signal tag of buy, sell, or neutral. No XML, no code table to maintain.
import requests
r = requests.get(
"https://api.edgrapi.com/v1/insider/NVDA",
headers={"X-API-Key": "edgr_your_key"},
params={"limit": 10, "form": "4"},
)
data = r.json()
for f in data["filings"]:
for t in f["transactions"]:
print(f["owner"], t["code"], t["signal"], t["value"])
# HUANG JEN-HSUN S sell 12400000.0
# a row tagged neutral is compensation noise, not a decision
Each transaction also carries plan_10b5_1, a true or false flag for pre-scheduled trades, and shares_owned_after, so you can watch the position size move. The raw SEC route works too: list the company's Form 4 filings, fetch each ownership XML, and parse Table I and Table II yourself. It is free and needs only a User-Agent header, which the SEC EDGAR API key guide covers.
The friction in the raw route is not the fetch. It is the parse. The wrapped value fields, the two tables, the footnotes, and the code decoding all have to be handled before a single number is trustworthy.
How do you know if an insider buy is meaningful?
Start with the code, then strip the routine. A meaningful buy is code P, an open-market purchase where the insider spent their own cash at the market price. The evidence is strong: a 2012 Journal of Finance study, "Decoding Inside Information," found that opportunistic insider trades earned value-weighted abnormal returns of 82 basis points a month, while routine trades earned essentially nothing.
So not all insider buying is equal.
The same study, by Cohen, Malloy, and Pomorski, found that routine traders, the insiders who trade on the same calendar every year, make up more than half of all insider activity and carry no predictive power, per the NBER working paper. The signal sits with the insiders who rarely trade and then suddenly buy.
A practical filter looks like this. Keep code P. Drop A, M, and F. Weight a CEO or CFO buy above a director's. And treat several insiders buying at once as louder than any one name.
Does a 10b5-1 sale mean anything?
Usually not, and that is the point of the rule. A Rule 10b5-1 plan lets an insider schedule trades months in advance, at a time when they are clean of material non-public information, per DFIN. When a sale later executes on that plan, it reflects a decision made long ago, not a fresh read on the stock, so it carries little signal.
This is why a raw sell count lies to you.
An insider can sell every quarter on a plan set up two years earlier, and a naive parser reads each one as a bearish event. It is not. It is the plan running on autopilot.
Edgrapi scans the filing's footnotes for a 10b5-1 mention and sets plan_10b5_1 to true on those transactions, so you can drop scheduled sales before you count. Research adds a wrinkle: a 2023 Journal of Financial Economics study found insiders can still time plan sales opportunistically, so the flag is a filter, not a guarantee.
What is a cluster buy, and how do you find one?
A cluster buy is when several different insiders at the same company buy the stock inside a short window. It is the strongest of the insider signals, because coordinated buying is hard to write off as one person's need for cash. Edgrapi exposes it directly: GET /v1/insider/clusters returns companies where three or more insiders made open-market purchases within a set number of days.
One director buying is a data point. Five buying in a week is a message.
curl "https://api.edgrapi.com/v1/insider/clusters?min_insiders=3&days=15" \
-H "X-API-Key: edgr_your_key"
There is also GET /v1/insider/latest, a market-wide feed of the biggest open-market insider buys across every company, filtered to code P and sorted by size. It is the quickest way to see where insiders are putting real money today, without polling one ticker at a time.
Form 4 or 13F: which one should you use?
Use Form 4 for speed and individuals, 13F for scale and institutions. Form 4 shows a single insider's own trade within two business days, and it covers both buys and sells. A 13F shows an entire fund's long book, but only quarterly and 45 days late. They answer different questions, and the timing gap is the main reason.
| Form 4 | 13F | |
|---|---|---|
| Who files | Directors, officers, 10% owners | Managers over $100M |
| What it shows | One insider's own trade | A fund's full long book |
| Speed | 2 business days | 45 days after quarter-end |
| Direction | Buys and sells | Long only |
| Edgrapi endpoint | /v1/insider | /v1/holdings |
If you are building a signal, the two pair well. Form 4 tells you what insiders are doing this week, and 13F tells you where the big institutions stood last quarter.
Point either one at https://api.edgrapi.com with a free key, and start with one company you already follow.
Frequently asked questions
What is an SEC Form 4?
A Form 4 is the filing a company insider, a director, officer, or holder of more than 10 percent of the stock, submits when they trade their own company's shares. Under Section 16 of the Securities Exchange Act, they must file it within two business days of the trade. It names the insider, their role, the transaction code, the share count, and the price.
How do I get Form 4 data as JSON?
The fastest way is a hosted endpoint that parses the ownership XML. Edgrapi's GET /v1/insider/{ticker} returns each insider's recent trades as JSON, with the transaction code, a buy, sell, or neutral signal, share count, price, and value. The raw route is free too: list the company's Form 4 filings on EDGAR and parse the ownership XML yourself, handling both the derivative and non-derivative tables.
What do the Form 4 transaction codes mean?
Each trade carries a one-letter code. P is an open-market purchase and S is an open-market sale, the trades the insider chose to make. A is a stock grant, M is an option exercise, and F is shares withheld for tax, all compensation rather than a market call. Code P is the only one where the insider spent their own money at the market price.
Is insider buying a bullish signal?
Sometimes. An open-market purchase, code P, by an insider spending their own cash is the meaningful one, and it is strongest when an insider who rarely trades suddenly buys. A 2012 Journal of Finance study found these opportunistic trades earned about 82 basis points a month in abnormal returns, while routine, scheduled trades earned essentially nothing. Grants and option exercises are not buy signals.
Does a Rule 10b5-1 sale mean anything?
Usually little. A 10b5-1 plan lets an insider schedule trades months ahead, when they are clean of inside information, so a sale on that plan reflects an old decision, not a fresh view. That is why a raw sell count misleads you. Edgrapi flags pre-scheduled sales with a plan_10b5_1 field so you can drop them before you read a company's selling as bearish.
What is the difference between Form 4 and 13F?
Form 4 is one insider's own trade at a single company, filed within two business days, covering both buys and sells. A 13F is an institutional manager's entire long book, filed quarterly and 45 days late. Form 4 is fast and individual; 13F is broad and slow. Use Form 4 to watch insiders in near real time, and 13F to see where large funds sit.