P should not be treated as a recommendation.
For a product-level workflow, see the insider trading monitor. For filing mechanics, see the Form 4 glossary.
Prerequisites
- An SEC API key in
SECAPI_API_KEY curl, or Python 3.8+ / Node.js 18+ for the examples below
1. Retrieve recent Form 4 rows
Start with a single issuer and Form 4. The response is a list envelope; the records are indata.
transactionCode, transactionDirection, the reported owner, transaction shares and price when disclosed, the accession number, and provenance. Keep the source fields with any downstream note.
2. Filter a reported transaction code
Form 4 codeP identifies a reported purchase transaction. Scope the query to Form 4 before using the code filter:
transactionDirection is a separate normalized field (acquired, disposed, or unknown). Preserve both values instead of inventing a single buy/sell label.
3. Build a compact review with Python
This example uses the REST contract directly, so each filter maps one-for-one to the documented endpoint.None for a field the filing does not provide. That is intentional: a review workflow should make missing evidence visible rather than silently estimating it.
4. Review one reporting owner
Useowner_name or owner_cik to focus on a specific reporting owner. This Node.js example calls the public REST endpoint directly.
5. Add the judgment the API cannot supply
Before escalating a transaction, read the linked filing and ask:- Is the row common stock, an option exercise, a derivative security, or another instrument?
- Is the transaction code consistent with the conclusion you are drawing?
- Are the transaction date, filing date, and any amendment material to the timing?
- Does the filing footnote describe a plan, tax withholding, gift, or other context that changes the interpretation?
- Are you comparing like-for-like records across issuers and reporting owners?
Next steps
- Read the insider trading API guide for the full filter set.
- Build a filing monitor when you need a durable alerting workflow.
- Pair the results with 13F holdings, while remembering that 13F data is delayed and incomplete by design.

