npm hub

npm Registry Changes API

The registry's change feed from a sequence, with package names and deletion markers, for incremental indexing.

GET /v1/npm/registry/changes

1 credit Failed requests are free

About this endpoint

GET /v1/npm/registry/changes?since=141000000&limit=100 returns data.changes, one row per change with seq, name and deleted. data.lastSeq is the registry sequence at the end of the page, and data.page carries hasMore, nextCursor, page, perPage and total.

Sequences run from the oldest change (about 832,853) to the current end. Omit since or pass 0 to start at the oldest change, which is a full backfill. No call returns the registry's current sequence, so a feed cannot be started at the current point by asking. To start near recent changes, pass a recent sequence such as 141000000 and read forward; to continue, pass the lastSeq from a page you already read. In normal use, pass data.page.nextCursor as cursor to continue from the last sequence of the previous page, and do not combine it with since. limit is 1 to 1,000 and defaults to 100. deleted: true marks a removed document; the package may still exist in the registry as a tombstone, so do not treat it as proof that the name is gone. An empty page is the end of the observed feed.

npm Registry Changes API FAQ

How do I keep an index in sync?

Store data.lastSeq from the last page you processed, then call again with since set to that value. Each page returns up to 1,000 changes. This route reports changes, not the package documents, so fetch the named packages separately.

Where do I get a starting sequence?

No call returns the registry's current sequence. To start near recent changes, pass a recent sequence such as 141000000 and read forward, then keep the lastSeq of each page for the next call. since=0 starts at the oldest recorded change, so use it only for a full backfill; walking from there to recent changes takes many pages.

What does deleted mean?

deleted is true when the registry document was removed. The package may still be in the registry, for example after a version was unpublished. Verify with GET /v1/npm/package before removing a package from your own store.

How many changes can one page hold?

Up to 1,000. The default is 100. Use the cursor rather than an increasing since value when you are paging through a backlog, because the cursor is tied to the position in the feed.

What happens when the feed is empty?

The page is found with data.changes: [] and hasMore false. That is the end of the observed feed at that cursor, not an error. Poll again later from the last sequence you stored.

What does the request cost?

Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth. Each paginated page is a separate billed request.