Insider Transactions API
Retrieve insider trading data from SEC Form 4 filings. Track executive purchases, sales, option exercises, and ownership changes for any ticker.
Endpoint
Section titled “Endpoint”GET /v1/insidertransactions/{market}/{ticker}Authentication
Section titled “Authentication”Requires API key via token query parameter.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
market | string | Yes | Market identifier (e.g., S&P 500, NASDAQ) |
ticker | string | Yes | Stock ticker symbol (e.g., AAPL, MSFT) |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Your API key |
dateFrom | string | No | Start date (YYYY-MM-DD) |
dateTo | string | No | End date (YYYY-MM-DD) |
Request
Section titled “Request”curl "https://api.finbrain.tech/v1/insidertransactions/S%26P%20500/AAPL?token=YOUR_API_KEY"from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get as DataFrame (recommended)df = fb.insider_transactions.ticker("S&P 500", "AAPL", as_dataframe=True)print(df.head())# insiderTradings relationship transaction shares cost USDValue# date# 2024-01-15 Tim Cook Chief Executive Officer Sale 50000 185.50 9275000
# Get raw JSON responsetransactions = fb.insider_transactions.ticker("S&P 500", "AAPL")print(transactions)#include <iostream>#include <string>#include <curl/curl.h>#include <nlohmann/json.hpp>
using json = nlohmann::json;
size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* userp) { userp->append((char*)contents, size * nmemb); return size * nmemb;}
json get_insider_transactions(const std::string& market, const std::string& ticker, const std::string& api_key) { CURL* curl = curl_easy_init(); std::string response;
if (curl) { char* encoded_market = curl_easy_escape(curl, market.c_str(), 0); std::string url = "https://api.finbrain.tech/v1/insidertransactions/" + std::string(encoded_market) + "/" + ticker + "?token=" + api_key; curl_free(encoded_market);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); curl_easy_perform(curl); curl_easy_cleanup(curl); }
return json::parse(response);}
int main() { auto data = get_insider_transactions("S&P 500", "AMZN", "YOUR_API_KEY");
for (auto& t : data["insiderTransactions"]) { std::cout << t["date"].get<std::string>() << " - " << t["insiderTradings"].get<std::string>() << ": " << t["transaction"].get<std::string>() << " (" << t["shares"].get<int>() << " shares @ $" << t["cost"].get<double>() << ")" << std::endl; }
return 0;}use reqwest::blocking::Client;use serde::Deserialize;use std::error::Error;
#[derive(Debug, Deserialize)]struct InsiderTransaction { date: String, #[serde(rename = "insiderTradings")] insider_tradings: String, relationship: String, transaction: String, cost: f64, shares: i64, #[serde(rename = "USDValue")] usd_value: i64, #[serde(rename = "totalShares")] total_shares: i64, #[serde(rename = "SECForm4Date")] sec_form4_date: String, #[serde(rename = "SECForm4Link")] sec_form4_link: String,}
#[derive(Debug, Deserialize)]struct InsiderResponse { ticker: String, name: String, #[serde(rename = "insiderTransactions")] insider_transactions: Vec<InsiderTransaction>,}
fn get_insider_transactions(market: &str, ticker: &str, api_key: &str) -> Result<InsiderResponse, Box<dyn Error>> { let url = format!( "https://api.finbrain.tech/v1/insidertransactions/{}/{}?token={}", urlencoding::encode(market), ticker, api_key );
let client = Client::new(); let response: InsiderResponse = client.get(&url).send()?.json()?;
Ok(response)}
fn main() -> Result<(), Box<dyn Error>> { let data = get_insider_transactions("S&P 500", "AMZN", "YOUR_API_KEY")?;
for t in &data.insider_transactions { println!("{} - {}: {} ({} shares @ ${:.2})", t.date, t.insider_tradings, t.transaction, t.shares, t.cost); }
Ok(())}const market = encodeURIComponent("S&P 500");const response = await fetch( `https://api.finbrain.tech/v1/insidertransactions/${market}/AAPL?token=YOUR_API_KEY`);const data = await response.json();Response
Section titled “Response”Success Response (200 OK)
Section titled “Success Response (200 OK)”{ "ticker": "AMZN", "name": "Amazon.com Inc.", "insiderTransactions": [ { "date": "Mar 08 '24", "insiderTradings": "Selipsky Adam", "relationship": "CEO Amazon Web Services", "transaction": "Sale", "cost": 176.31, "shares": 500, "USDValue": 88155, "totalShares": 133100, "SECForm4Date": "2024-03-11T16:34:00.000Z", "SECForm4Link": "http://www.sec.gov/Archives/edgar/data/1018724/000101872424000058/xslF345X05/wk-form4_1710189274.xml" } ]}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
ticker | string | Stock ticker symbol |
name | string | Company name |
insiderTransactions | array | Array of transaction objects |
Transaction Object Fields
Section titled “Transaction Object Fields”| Field | Type | Description |
|---|---|---|
date | string | Transaction date (e.g., “Mar 08 ‘24”) |
insiderTradings | string | Insider name |
relationship | string | Insider’s role/relationship |
transaction | string | Type of transaction |
cost | number | Transaction price per share |
shares | integer | Number of shares |
USDValue | integer | Total transaction value in USD |
totalShares | integer | Total shares owned after transaction |
SECForm4Date | string | SEC Form 4 filing date (ISO 8601) |
SECForm4Link | string | Link to SEC Form 4 filing |
Transaction Types
Section titled “Transaction Types”| Type | Description |
|---|---|
| Buy | Open market purchase |
| Sale | Open market sell |
| Option Exercise | Stock option conversion |
| Gift | Shares donated |
| Automatic | 10b5-1 plan execution |
Errors
Section titled “Errors”| Code | Error | Description |
|---|---|---|
| 400 | Bad Request | Invalid market or ticker |
| 401 | Unauthorized | Invalid or missing API key |
| 404 | Not Found | Ticker not found |
| 500 | Internal Server Error | Server-side error |
Related
Section titled “Related”- Insider Transactions Dataset - Use cases and analysis examples
- House Trades - Congressional trading data
- Ticker Predictions - Price predictions