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

@sentry/api

v0.188.0

Published

Official auto-generated TypeScript client for the Sentry public REST API

Readme

@sentry/api

The official, auto-generated TypeScript client for Sentry's public REST API.

npm license

Install

npm install @sentry/api

Usage

Pass baseUrl and an auth header to each call:

import { listYourOrganizations } from "@sentry/api";

const { data, error } = await listYourOrganizations({
  baseUrl: "https://sentry.io",
  headers: { Authorization: `Bearer ${process.env.SENTRY_AUTH_TOKEN}` },
});

if (error) throw error;
console.log(data);

Auth tokens and base URLs (including self-hosted and region URLs) are documented at https://docs.sentry.io/api/auth/.

Pagination

Sentry uses cursor-based pagination via Link headers. Every operation in the SDK that accepts a cursor query parameter has three auto-generated typed wrappers:

  • fetchPage_<operation>(options, cursor?) — fetch a single page; returns { data, nextCursor?, prevCursor? }.
  • paginateAll_<operation>(options, paginateOptions?) — eagerly fetch all pages, returning the concatenated array. Bounded by maxPages (default 50) for safety. Available only for endpoints whose 200 response is Array<...>.
  • paginateUpTo_<operation>(options, paginateOptions) — fetch up to a hard limit of items; suppresses nextCursor when the last page is trimmed (so callers resuming pagination won't skip records). Available only for endpoints whose 200 response is Array<...>.

The wrappers manage cursor for you — passing one in query is a type error. Every wrapper's query is also widened with an optional per_page?: number field, since Sentry's pagination framework accepts per_page on every cursor-paginated route at runtime even when the spec omits it.

Single page

import { fetchPage_listAnOrganization_sIssues } from "@sentry/api";

const { data, nextCursor } = await fetchPage_listAnOrganization_sIssues({
  baseUrl: "https://sentry.io",
  headers: { Authorization: `Bearer ${process.env.SENTRY_AUTH_TOKEN}` },
  path: { organization_id_or_slug: "my-org" },
  query: { collapse: ["stats"], limit: 25 },
});

All pages

import { paginateAll_listAnOrganization_sProjects } from "@sentry/api";

const projects = await paginateAll_listAnOrganization_sProjects({
  baseUrl: "https://sentry.io",
  headers: { Authorization: `Bearer ${process.env.SENTRY_AUTH_TOKEN}` },
  path: { organization_id_or_slug: "my-org" },
});

Bounded pagination

import { paginateUpTo_listAnOrganization_sIssues } from "@sentry/api";

const { data, nextCursor } = await paginateUpTo_listAnOrganization_sIssues(
  {
    baseUrl: "https://sentry.io",
    headers: { Authorization: `Bearer ${process.env.SENTRY_AUTH_TOKEN}` },
    path: { organization_id_or_slug: "my-org" },
    query: { limit: 100 },
  },
  {
    limit: 250,
    onPage: (fetched, target) => console.log(`fetched ${fetched}/${target}`),
  },
);

By default, paginateUpTo drops nextCursor if the last fetched page had to be trimmed to fit limit — returning a cursor that points past the trimmed items would cause callers resuming pagination to skip records. For endpoints with no server-side per_page control (e.g. /issues/{id}/events/), pass keepCursorOnOvershoot: true to preserve the cursor; the trimmed-tail items remain reachable via the same cursor on the next call.

nextCursor is also dropped if paginateUpTo reaches maxPages (default 50) before fulfilling limit — raise maxPages to continue paginating.

Generic pagination helpers

The same low-level helpers used by the generated wrappers are also exported for advanced use cases:

  • parseSentryLinkHeader(header){ nextCursor?, prevCursor? }
  • unwrapResult(sdkResult, context) — throw-on-error data unwrap
  • unwrapPaginatedResult(sdkResult, context) — same but with cursors
  • fetchPage, paginateAll, paginateUpTo — generic versions taking a fetcher thunk

Schema source

The OpenAPI schema is synced from getsentry/sentry. Schema fixes belong there; build/tooling changes belong here.

License

FSL-1.1-Apache-2.0. See LICENSE.md.