npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@secblast/sdk

v3.1.0

Published

TypeScript SDK for the SEC Blast v3 API: SEC EDGAR filings, documents, full-text search, and XBRL financial data

Readme

SEC Blast TypeScript SDK

The TypeScript and JavaScript client for the SEC Blast v3 API: SEC EDGAR filings, documents, full-text search, XBRL financial data, ownership data, and the filing stream.

Version 3 targets the v3 API (https://api.secblast.com/v3). Versions 2.x targeted the v2 API.

Install

npm install @secblast/sdk

It runs on Node.js 18 or later, Deno, Bun, and browsers, with the built-in fetch. It has no runtime dependencies. It ships ES modules, CommonJS, and type declarations.

Quickstart

import { SecBlastClient } from '@secblast/sdk';

const client = new SecBlastClient(); // reads SECBLAST_API_KEY
const page = await client.listFilings({ ticker: 'AAPL', form: '10-K', limit: 5 });
for (const filing of page.data) console.log(filing.accession, filing.filing_date);

The client

const client = new SecBlastClient({
  apiKey: 'sb_...',                         // an API key or an OAuth access token; default: SECBLAST_API_KEY
  baseUrl: 'https://api.secblast.com/v3',   // default: SECBLAST_BASE_URL, then this URL
  timeoutMs: 60_000,
  maxRetries: 3,                            // retries of 429 and 503 responses
  maxRetryWaitMs: 60_000,                   // the longest Retry-After to wait for
  fetch: customFetch,                       // optional
});

The credential is sent as Authorization: Bearer <credential>.

Methods

There is one method for each v3 operation, such as listFilings, getFiling, getEntity, search, getIncomeStatement, listInsiderTransactions, and createEndpoint. Path parameters come first. Query parameters are one object with the API's names. The last argument takes signal, timeoutMs, extraParams, and headers.

const entity = await client.getEntity('AAPL');            // a CIK or a ticker
const filing = await client.getFiling('0000320193-26-000026');
const hits = await client.search({ q: '"going concern"', forms: '10-K', filed_from: '2024-01-01', limit: 10 });
const income = await client.getIncomeStatement('MSFT', { period: 'annual', limit: 5 });
  • List parameters take an array or a comma-separated string: ticker: ['AAPL', 'MSFT'] and ticker: 'AAPL,MSFT' are the same. Booleans are sent as true and false. Dates take a string or a Date (its UTC day is sent).
  • Every schema in the OpenAPI document is an exported type, such as Filing, Entity, and SearchHit.

Paging

List methods return one page: data, has_more, and next_cursor. Each paged method has an iter* twin that follows next_cursor until has_more is false. It makes requests as you iterate.

for await (const row of client.iterInsiderTransactions({ issuer_ticker: 'TSLA', filed_from: '2025-01-01' })) {
  console.log(row);
}

const page = await client.listFilings({ cik: 320193, limit: 100 });
const next = await client.listFilings({ cik: 320193, limit: 100, cursor: page.next_cursor ?? undefined });

Documents

const docs = (await client.listDocuments('0000320193-26-000026')).data;
const raw = await client.getDocument('0000320193-26-000026', 1);       // Uint8Array, as filed
const text = await client.getDocumentText('0000320193-26-000026', 1);  // string, the extracted text
const pdf = await client.getDocumentPdf('0000320193-26-000026', 1);    // Uint8Array, a PDF of one document
const whole = await client.getFilingPdf('0000320193-26-000026');       // Uint8Array, a PDF of the filing

A document is named by its sequence number or its file name.

Errors

Every error response throws an APIError subclass built from the RFC 9457 problem body. It has status, code, detail, requestId, parameter, and the whole body in problem. code is stable.

| Status | Error | |---|---| | 400, 422 | ValidationError | | 401 | AuthenticationError | | 403 | PermissionDeniedError | | 404 | NotFoundError | | 409 | ConflictError | | 410 | GoneError | | 429 | RateLimitError, with retryAfter in seconds | | 503 | ServiceUnavailableError | | other 5xx | ServerError |

No HTTP response (DNS, connection, or timeout) throws APIConnectionError. All of them are SecBlastError.

import { ValidationError } from '@secblast/sdk';

try {
  await client.listFilings({ ticker: 'NOPE' });
} catch (e) {
  if (e instanceof ValidationError) console.log(e.status, e.code, e.detail, e.requestId); // 400 unknown_ticker ...
}

Retries: a 429 or 503 response is retried up to maxRetries times. The client waits for Retry-After when the header is present and at most maxRetryWaitMs; a longer Retry-After throws the error at once. Without the header, it waits about 0.5, 1, 2, and 4 seconds. A GET that gets no response is retried the same way.

Stream

stream() long-polls GET /v3/stream and returns events as they arrive. It takes the getStream filters (forms, tickers, ciks, items, types, and so on).

const stream = client.stream({ after: savedCursor, forms: ['8-K'], items: ['2.02'] });
for await (const event of stream) {
  await handle(event);        // event.id, event.type, event.data.filing
  await save(stream.cursor);  // where to resume
}
  • after is a next_cursor from an earlier run, or 'now'. Left out, the stream starts at the newest event.
  • stream.cursor moves to a page's next_cursor after the last event of that page. Resuming from it in the middle of a page delivers the rest of that page again. Each event has an id.
  • The iterator runs until you stop it (break). With stopWhenCaughtUp: true, it stops when a page has has_more false; add wait: 0 to return at once.

Webhooks

verifyWebhook checks the webhook-id, webhook-timestamp, and webhook-signature headers of a delivery (Standard Webhooks v1) against the endpoint's signing secret and returns the parsed JSON body.

import { verifyWebhook, WebhookVerificationError } from '@secblast/sdk/webhooks';

try {
  const event = verifyWebhook(rawBody, req.headers as Record<string, string>, 'whsec_...');
} catch (e) {
  if (e instanceof WebhookVerificationError) {
    // answer 400
  }
}
  • Node only: the verifier is the @secblast/sdk/webhooks subpath, so the main entry has no node:crypto import and bundles for browsers.
  • rawBody is the request body as a string or bytes, exactly as received; the signature covers <webhook-id>.<webhook-timestamp>.<body>. A string is encoded as UTF-8 before checking. A body parsed and serialized again (express.json(), JSON.stringify) is not the signed byte sequence and does not verify; express.raw({ type: 'application/json' }) keeps the bytes.
  • Signature check: base64(HMAC-SHA256) with the secret's bytes (the base64 after whsec_), compared in constant time. The header holds one or more space-separated v1,<signature> entries; two entries are sent while a rotated secret's previous value still signs, and the delivery verifies when any entry matches. secret can also be an array of whsec_ values.
  • Tolerance: the webhook-timestamp must be within 5 minutes of the clock (toleranceS: 300; now sets the reference time, in Unix seconds). A non-finite or negative toleranceS, or a non-finite now, throws WebhookVerificationError. SEC Blast stamps every attempt with its own time.
  • Deduplication: the webhook-id is the same on every attempt of a delivery, and is the id in the body.
  • Throws WebhookVerificationError for a missing header, a timestamp outside the tolerance, no matching v1 signature, a secret that is not a whsec_ value, or a body that is not a JSON object.

License

MIT