Read a 13F information table without inventing value units

Retrieve an investment manager’s13F rows and preserve reported values, security identifiers, and amendment context.

WHAT YOU WILL BUILD

Select a manager’s13F-HR accession, parse its information table, and preserve the reported value strings and unit metadata. Do not apply a universal thousands-to-dollars multiplier.

Requirements: Node.js 22 or later; no extra packages. An API key from your dashboard, stored in the SEC_API_KEY environment variable.

Run the workflow

Save this as workflow.mjs and run node workflow.mjs. The production base URL is used by default. Keep credentials out of source control.

// Node.js 22+. Set SEC_API_KEY before running.
const key = process.env.SEC_API_KEY;
if (!key) throw new Error("Set SEC_API_KEY first");
const base = process.env.SEC_API_BASE_URL || "https://sec-api.dev";
async function request(path) {
  const response = await fetch(base + path, {
    headers: { Authorization: "Bearer " + key }
  });
  if (!response.ok) {
    throw new Error("HTTP " + response.status + ": " + await response.text());
  }
  return response.json();
}
const cik = process.env.SEC_CIK || "1067983";
const filings = await request("/api/v1/filings?" + new URLSearchParams({cik, form:"13F-HR", limit:"1"}));
if (!filings.data.length) throw new Error("No recent 13F-HR for this manager");
const result = await request("/api/v1/holdings?" + new URLSearchParams({
  cik, accession:filings.data[0].accessionNumber, limit:"100"
}));
console.log(JSON.stringify({positions:result.data, context:result.meta,
  pagination:result.pagination}, null, 2));

Use the manager’s identifier

A portfolio report belongs to the filing investment manager. The CIK of an issuer that appears in the portfolio is not a substitute for the manager CIK. The example uses one manager and selects a recent13F-HR accession. Amendments have their own exact form label and should be retrieved deliberately when the analysis requires them.

Preserve the information table as reported

CUSIPs and other identifiers remain strings so leading zeroes survive. The output retains voting authority and share-or-principal-amount context rather than reducing a row to a ticker and value. Reported value scales differ across historical reporting regimes; inspect the source and metadata before conversion. No generic multiplier is applied in this script.

Define your portfolio reconciliation separately

A single information table is not automatically a complete economic portfolio. Amendments, confidential treatment, put/call distinctions, and other-manager relationships can affect interpretation. The endpoint does not resolve these into a canonical portfolio. Inspect pagination because this example requests at most100rows; do not calculate portfolio weights using a partial table without explicitly acknowledging the selected denominator.

Sources and further reading

The underlying SEC dataset behavior is documented in the official SEC API reference and SEC technical specifications. Response-field names shown here belong to the sec-api.dev endpoint contract. The scripts print actual results and do not embed fabricated filing or financial data.

All tutorials ←