SEC Form 4 API: How to Pull Insider Transactions as JSON
There is no official SEC Form 4 API. Here is where the raw data lives on EDGAR and how to pull insider transactions as structured JSON instead.
- The SEC does not publish a dedicated "Form 4 API": the underlying data is an XML ownership document attached to each filing, not a queryable endpoint.
- Pulling it yourself means fetching each filing's XML, parsing owners, transaction codes and share counts, and merging that with the filing index to search across companies.
- A filings API such as SecFeed returns those same fields as JSON rows, filterable by ticker, transaction code, value and date, without you writing an XML parser.
- Electronic filing of Forms 3, 4 and 5 became mandatory in mid-2003, so structured insider transaction data before that point does not exist in the same form.
Getting Form 4 data into code almost always means one of two things: writing a parser for the XML document the SEC attaches to each ownership filing, or calling an API that has already done that parsing. There is no official, SEC-run "Form 4 API" you can just sign up for. This guide covers where the raw data actually lives, what you have to handle yourself if you parse it directly, and how to pull the same fields as JSON with a documented endpoint instead.
What "Form 4 API" usually means
Form 4 is the SEC filing officers, directors and 10% owners submit when their ownership of a company's stock changes, covered in detail in SEC Form 4 explained. When people search for a "Form 4 API," they are not looking for the form itself, they want the transactions inside it as rows they can filter: every purchase by a given code, every sale over a certain value, every transaction for a ticker in a date range. That is a use case EDGAR's own tools were not built for, since EDGAR indexes filings, not the transactions recorded inside their documents.
Where the raw data actually lives on EDGAR
Each Form 4 filing includes a machine readable ownership document, an XML file with a structure defined by the SEC's ownership XML schema. It contains the issuer, the reporting owner or owners, and a table of non-derivative and derivative transactions, each with a transaction code, a date, a share count, a price and whether it increased or decreased the holding.
EDGAR does not expose those fields through a general query endpoint. Two things come close, and both stop short of transaction-level search:
- The submissions API (
data.sec.gov/submissions/CIK##########.json) lists every filing a company has made, including its form type and accession number, but not what is inside the filing. - EDGAR full text search can find filings containing a phrase, but it searches rendered text, not the structured fields of the ownership XML, and it does not let you filter by transaction code or share value.
Finding, say, every open market purchase over $100,000 by any insider at any company means fetching each candidate filing's XML and reading the transaction table yourself.
Get this data as clean JSON
SecFeed turns SEC filings into structured data with one API call: GET /v1/insider-trading?code=P&minValue=100000. Free key, no card needed.
Parsing a Form 4 yourself
If you fetch the XML directly, the fields you need to pull out of each transaction entry include:
| Field in the XML | What it holds |
|---|---|
transactionCode | A single letter: P (open market buy), S (open market sale), A (grant or award), M (option exercise), and others |
transactionShares | Number of shares in the transaction |
transactionPricePerShare | Price per share, when applicable |
transactionAcquiredDisposedCode | A for acquired, D for disposed |
sharesOwnedFollowingTransaction | Running total after the transaction |
reportingOwnerRelationship | Whether the filer is a director, officer, 10% owner or other |
Every transaction code has its own meaning, including several that are easy to misread as an open market trade when they are not; the full table is in Form 4 transaction codes explained. A Form 4 can also carry a flag marking a transaction as made under a Rule 10b5-1 trading plan, adopted in advance, which changes how you should read its timing.
Once you can parse one filing, pulling insider activity across many companies still means getting each company's accession numbers from the submissions API or the full index, fetching each filing's XML in turn, and keeping your own request rate under the SEC's fair access limit the whole time.
Pulling the same data as JSON
SecFeed's Insider Trading API parses every Form 3, 4 and 5 filing into rows with these fields already extracted, searchable by ticker, CIK, owner, transaction code, value and date range, documented at /docs/#v1-insider-trading. The endpoint that replaces the manual pull above is one call:
curl "https://secfeedapi.com/v1/insider-trading?code=P&minValue=100000&startDate=2026-01-01" \
-H "Authorization: Bearer YOUR_API_KEY"
That asks for every open market purchase (code=P) worth at least $100,000 since the start of the year, across every company at once, which is exactly the kind of cross-filer query a raw EDGAR pull cannot do in one request. A row in the response looks like this, with placeholder names in place of a real filer:
{
"accession": "0000912345-26-000031",
"tbl": "nonDerivative",
"code": "P",
"shares": 5000.0,
"price": 41.2,
"acq_disp": "A",
"owned_after": 62000.0,
"value": 206000.0,
"form": "4",
"filed": "2026-01-09",
"issuer_cik": 1234567,
"issuer_name": "EXAMPLECO INC",
"ticker": "EXMPL",
"owners": [
{"cik": "1000000", "name": "Doe Jane A.", "isDirector": true, "isOfficer": false, "isTenPercentOwner": false, "officerTitle": null}
],
"aff10b5one": false,
"codeDescription": "Open market or private purchase"
}
In Python with the SDK:
from secfeed import Client
sf = Client("YOUR_API_KEY")
buys = sf.insider_trades(ticker="NVDA", code="P", minValue=100000)
for t in buys["transactions"]:
print(t["filed"], t["owners"][0]["name"], t["shares"], t["value"])
The same endpoint takes table=nonDerivative to limit results to common stock transactions and leave out option and derivative activity, and formType=4 to exclude the initial ownership statements filed on Form 3.
What the parsed fields add beyond the raw XML
Two things do not show up by just reading the XML schema reference: the aff10b5one flag, which marks whether the SEC's own form data ties the transaction to a 10b5-1 trading plan, and codeDescription, a plain language label for each one-letter transaction code so you do not have to keep your own lookup table. Footnotes, which often carry the detail that explains an unusual transaction (a weighted average sale price, a gift, a trust), are returned as their own object keyed by footnote number rather than left inline in the document text.
Limits worth knowing before you build on this
An API built on Form 4 data inherits the limits of the filing itself, not just of the service wrapping it:
- No transactions before mid-2003. Electronic filing was not mandatory before then, so there is no structured data to parse for earlier periods.
- A Form 4 only reports the filer's own transactions. It does not show a company's full insider ownership at a point in time; for that, a Form 3 or the "shares owned following transaction" field on the most recent Form 4 is the closest proxy.
- Amendments exist. A Form 4/A corrects or adds to an earlier report. Treat the amendment as the current record for that transaction when both exist.
- It is not a trading signal. An insider purchase or sale reflects one person's transaction, for reasons that are not disclosed in the filing. Reading it as advice about where a stock is headed goes beyond what the data supports.
Frequently asked questions
Is there an official SEC Form 4 API?
No. The SEC publishes Form 4 filings and their XML ownership documents on EDGAR, and a submissions endpoint that lists filing metadata, but no SEC-run endpoint returns individual transactions as queryable, filterable data.
How far back does Form 4 data go in structured form?
Electronic filing of Forms 3, 4 and 5 became mandatory in mid-2003 under Sarbanes-Oxley. Filings from before that are mostly on EDGAR as scanned or plain text documents rather than the structured XML used today.
Can I filter insider transactions by transaction code?
Yes. The code parameter on SecFeed's insider trading endpoint accepts one-letter transaction codes such as P for purchases, S for sales, A for grants and M for option exercises, and multiple codes separated by commas.
Does the data include whether a trade was under a 10b5-1 plan?
Yes, as a boolean flag on each transaction, read from the filing's own disclosure, not inferred.
What is the difference between Form 4 and Form 3 data in the same API?
Form 3 is the initial ownership statement a new insider files, with no transactions, just starting holdings. Form 4 reports changes after that. Both come through the same endpoint and can be told apart with the formType parameter.
Get this data as clean JSON
SecFeed turns SEC filings into structured data with one API call: GET /v1/insider-trading?code=P&minValue=100000. Free key, no card needed.
For information only, not investment advice. Data from public SEC filings; verify important figures on SEC.gov. See our AI Disclosure.