Blog · 2026-07-13

SEC EDGAR API for Form 4: insider trading filings as JSON (2026)

Form 4 insider filing with transaction codes, filed within two business days, returned as JSON
Form 4 is where insiders report their own trades. Code P is the one that counts.

"CEO sells 40,000 shares" is a headline that gets written a hundred times a week. Most of the time it means nothing at all.

The filing behind that headline is a Form 4, and it carries a one-letter code that tells you whether the insider actually decided anything. Read the code and half those headlines evaporate.

The SEC EDGAR API returns a company's Form 4 record as clean JSON, so you can list every insider filing for a ticker and jump straight to the document. Here's what Form 4 reports, what the codes mean, and where the API stops.

Key takeaway: Form 4 is how a company insider reports a change in their ownership, within two business days of the trade. The SEC EDGAR API returns a ticker's Form 4 filings as JSON via GET /v1/filings/{ticker}?form=4, each with the filing date and a direct SEC.gov link. Transaction code P (open-market purchase) is the only code that means the insider spent their own money. It returns the filing record and link, not the parsed transactions.

What is SEC Form 4?

Form 4 is a "statement of changes in beneficial ownership." Under Section 16 of the Exchange Act, a company's officers, directors, and anyone holding more than 10% of a registered class of its equity count as insiders, and the SEC requires them to report most transactions in the company's stock within two business days.

Two business days is fast. A 10-Q takes weeks after the quarter closes.

And the clock starts at the trade date, not settlement, which is why Form 4 is the closest thing EDGAR has to a live feed of what the people running a company are doing with their own shares.

How do Form 3, Form 4, and Form 5 differ?

They're the same reporting regime at three speeds. Form 3 is the initial statement an insider files within 10 days of becoming one. Form 4 reports each change in ownership within two business days. Form 5 is the annual catch-up for deferred or exempt items, due within 45 days of the fiscal year end. If you want live activity, Form 4 is the only one that matters.

Form 3 within 10 days, Form 4 within 2 business days, Form 5 within 45 days of fiscal year end
Three forms, one regime. Only Form 4 moves at the speed of the trade.

Form 3 tells you someone joined the club. Form 5 is housekeeping. Form 4 is the transaction feed.

What do the Form 4 transaction codes mean?

Every Form 4 transaction carries a one-letter code, and that code is the whole story. P is an open-market purchase, S is a sale, A is a stock award, M is an option exercise or conversion, F is shares withheld for taxes, and G is a gift. Only P requires the insider to voluntarily spend their own cash, which is why it's the code worth building around.

Form 4 transaction codes: P open-market purchase is the real signal; A, M, F, S are usually automatic compensation events
Most Form 4 activity is compensation on autopilot. P is the exception.

Here's the set you'll actually see.

CodeWhat happenedDoes it signal anything?
POpen-market or private purchaseYes. They chose to buy with their own money
SSaleMaybe. Check the footnotes for a 10b5-1 plan
AGrant or award from the companyNo. That's compensation, not conviction
MOption exercise or conversionNo. Usually routine, often near expiry
FShares withheld to cover taxNo. The company did it automatically
GGiftNo. No market view involved

Why does most "insider selling" mean nothing?

Because the insider often didn't decide to sell. A huge share of Form 4 sales are an M followed by an S on the same day, an executive exercising options that were about to expire and flipping the shares, or an F where the company withheld stock to cover the tax bill on a vest. Neither is a view on the price. Even a real sale may be a 10b5-1 plan set up months earlier, before the insider knew anything.

This is where most insider-trading dashboards go wrong. They count share volume and call it sentiment.

If you're building a signal, filter to P first, then look at whether an S was flagged as part of a pre-set plan in the footnotes. A cluster of P transactions from several insiders at once is a genuinely different animal from one exec's scheduled sale.

How do you get a company's Form 4 filings from the API?

You call the filings endpoint with the form set to 4. With Edgrapi that's GET /v1/filings/{ticker}?form=4, your key in the X-API-Key header, and you get each Form 4 back as JSON with its filing date, accession number, and a direct link to the document on SEC.gov.

GET /v1/filings/AAPL?form=4 returns a JSON list of Form 4 filings with date, accession and SEC.gov url
Same endpoint as the 10-K or the 8-K. Only the form value changes.
import requests

r = requests.get(
    "https://api.edgrapi.com/v1/filings/AAPL",
    headers={"X-API-Key": "edgr_your_key"},
    params={"form": "4", "limit": 5},
)
for f in r.json()["filings"]:
    print(f["filed"], f["url"])
# 2026-02-04 https://www.sec.gov/Archives/edgar/data/320193/...
# 2026-02-03 https://www.sec.gov/Archives/edgar/data/320193/...

The same call with form=8-K gives you material events, covered in the 8-K guide, and form=13F-HR gives you institutional holdings, in the 13F guide. One endpoint, one key.

What the API returns, and what it doesn't

It returns the Form 4 record, not the parsed transactions. You get the form, the filing date, the accession number, and the link, which is what you need to list filings, dedupe them, and watch for new ones. The insider's name, the transaction code, the share count, and the price all live inside the filing's XML, so you follow the url for those.

The API returns the Form 4 record and link; the transaction codes, share counts and prices live in the filing XML
The endpoint is the index and the pointer. The XML behind the link holds the trade.

I'd rather say that plainly than let you find out after you've built on it. If you need parsed buys and sells with names attached, you either parse that XML yourself, which is small and regular enough to be reasonable, or you use a service built specifically for insider data. What this endpoint does well is tell you, cheaply and fast, that a Form 4 exists and where to read it.

For the numbers rather than the filings, fundamentals returns the statements, and sections pulls 10-K narrative text.

Start with one ticker's Form 4s

Grab a free key, call /v1/filings with form=4 on a company you follow, and open the last filing. Find the code. If it's a P, that's someone betting their own money.

The free tier is 100 credits a month, no card, which covers listing Form 4s across a watchlist. Point it at https://api.edgrapi.com and pull your first insider record. The endpoint is in the docs, and the complete SEC EDGAR API guide covers the rest of the filing types.

Frequently asked questions

What is SEC Form 4?

Form 4 is the filing a company insider submits when their ownership of the stock changes. Officers, directors, and anyone holding more than 10% of a class of equity are covered by Section 16, and they have two business days from the trade date to report a buy, a sale, a grant, or an option exercise.

How do I get Form 4 data from an API?

Call GET /v1/filings/{ticker}?form=4. Edgrapi returns each Form 4 for that company as JSON: the form, the filing date, the accession number, and a direct link to the filing on SEC.gov. The transaction details themselves live in the filing's XML, so you follow the link for those.

What do the Form 4 transaction codes mean?

P is an open-market purchase, S is a sale, A is a stock award from the company, M is an option exercise or conversion, F is shares withheld to cover taxes, and G is a gift. P is the only code that means the insider chose to spend their own money on the stock.

Does insider selling mean the stock is going down?

Usually not by itself. A lot of what looks like selling is an option exercise (M) flipped the same day, or shares the company withheld for taxes (F), or a sale scheduled months earlier under a 10b5-1 plan. Nobody made a call on the stock in any of those. Filter to P first.

How fast is a Form 4 filed after the trade?

Within two business days of the transaction, and the clock runs from the trade date rather than settlement. That makes Form 4 the closest thing EDGAR has to a live feed of insider activity, far ahead of the next quarterly report.

What is the difference between Form 3, Form 4, and Form 5?

Form 3 is the initial statement, filed within 10 days of becoming an insider. Form 4 reports each change in ownership within two business days. Form 5 sweeps up deferred or exempt items once a year, within 45 days of the fiscal year end. Form 4 is the one carrying live activity.

Get a free API key