Client Examples
Working code samples for curl, Python, JavaScript/TypeScript, and Pandas.
All examples use https://api.indexalpha.id with a Bearer token. Replace <YOUR_API_KEY> with a key from your dashboard. Remember that date ranges are aggregated - see Quick Start and the Endpoints reference.
curl
curl -X 'GET' \
'https://api.indexalpha.id/stocks/broker-summary?ticker=BBCA&from=2026-03-26&to=2026-03-26&investor=all' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>'Python
import requests
API_KEY = "<YOUR_API_KEY>"
BASE_URL = "https://api.indexalpha.id"
headers = {"Authorization": f"Bearer {API_KEY}"}
params = {"ticker": "BBCA", "from": "2026-03-26", "to": "2026-03-26", "investor": "all"}
resp = requests.get(f"{BASE_URL}/stocks/broker-summary", headers=headers, params=params)
resp.raise_for_status()
data = resp.json()["data"]
for row in data:
print(row["code"], row["buy_value"], row["sell_value"])JavaScript / TypeScript
const API_KEY = "<YOUR_API_KEY>";
const BASE_URL = "https://api.indexalpha.id";
const headers = {
Authorization: `Bearer ${API_KEY}`,
Accept: "application/json",
};
interface BrokerSummaryRow {
code: string;
buy_freq: number;
buy_volume: number;
buy_value: number;
sell_freq: number;
sell_volume: number;
sell_value: number;
buy_avg: number;
sell_avg: number;
}
async function getBrokerSummary(ticker: string, from: string, to: string, investor = "all") {
const params = new URLSearchParams({ ticker, from, to, investor });
const res = await fetch(`${BASE_URL}/stocks/broker-summary?${params}`, { headers });
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const body = await res.json();
return body.data as BrokerSummaryRow[];
}Pandas
import pandas as pd
import requests
API_KEY = "<YOUR_API_KEY>"
BASE_URL = "https://api.indexalpha.id"
headers = {"Authorization": f"Bearer {API_KEY}"}
params = {"ticker": "BBCA", "from": "2026-03-26", "to": "2026-03-26", "investor": "all"}
resp = requests.get(f"{BASE_URL}/stocks/broker-summary", headers=headers, params=params)
resp.raise_for_status()
df = pd.DataFrame(resp.json()["data"])
print(df.head())To load a batch of tickers into one DataFrame:
import pandas as pd
import requests
API_KEY = "<YOUR_API_KEY>"
BASE_URL = "https://api.indexalpha.id"
headers = {"Authorization": f"Bearer {API_KEY}"}
payload = {
"tickers": ["BBCA", "BBRI", "TLKM"],
"from": "2026-03-26",
"to": "2026-03-26",
"investor": "all",
"market": "RG",
}
resp = requests.post(f"{BASE_URL}/stocks/broker-summary/batch", json=payload, headers=headers)
resp.raise_for_status()
frames = []
for ticker, rows in resp.json()["data"].items():
frame = pd.DataFrame(rows)
frame.insert(0, "ticker", ticker)
frames.append(frame)
df = pd.concat(frames, ignore_index=True)
print(df.head())Quota and errors
Responses include X-Monthly-Remaining and X-RateLimit-* headers. If you exceed your per-minute rate limit you get 429; if you exhaust your monthly quota you get 403. Checking usage with GET /usage is always free. See Errors and Limits & Quotas.