Compare original and amended filing metadata

Retrieve10-K and10-K/A records separately and inspect their accessions and reporting dates without overwriting the original filing.

WHAT YOU WILL BUILD

Use exact form filters for original and amended filings, preserve both record sets, and group by reported period only as a review aid—not as automatic amendment reconciliation.

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 outputs = [];
for (const form of ["10-K", "10-K/A"]) {
  const result = await request("/api/v1/filings?" + new URLSearchParams({
    cik: "320193", form, history: "all", limit: "100"
  }));
  outputs.push({form, records:result.data.map(row => ({
    accessionNumber:row.accessionNumber, reportDate:row.reportDate,
    filingDate:row.filingDate, documentUrl:row.documentUrl
  })), pagination:result.pagination, source:result.meta});
}
console.log(JSON.stringify(outputs, null, 2));

Treat amendments as separate filings

An exact10-K request does not implicitly include10-K/A. Request both labels when the research question requires them. Keeping separate accessions avoids overwriting the original document with an amended filing just because the two share a reporting date. A later amendment may change only a limited portion of the original disclosure.

Use dates as evidence, not a reconciliation algorithm

A common reportDate can help a reviewer find related records, but it is not proof that one filing fully replaces another. Examine filing dates, document contents, and amendment explanations before deciding how to combine them. Missing reporting dates should remain missing rather than being inferred from the year in a filename.

Preserve independent pagination and provenance

The two exact-form result sets can have different totals and next offsets. Check both before declaring the comparison complete. Store both response metadata objects because the source can refresh between requests. The example prints candidate records for review; it does not assert a final restated financial series.

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 ←