npm hub

npm Search API

Search by words or qualifiers such as author:, maintainer:, keywords: and not:deprecated, with npm's score and download counts on every result.

GET /v1/npm/packages/search

1 credit Failed requests are free

About this endpoint

GET /v1/npm/packages/search?query=react&limit=20 returns data.results, each with name, version, description, keywords, license, homepage, repositoryUrl, bugsUrl, publishedAt, publisher, maintainers, score (final, quality, popularity, maintenance), searchScore, downloads (weekly and monthly), dependentsCount and indexedAt. data.total is the match count npm reports and data.page carries the paging state.

Query text is 2 to 64 characters. npm's qualifiers work: author:isaacs, maintainer:, keywords:a,b, not:deprecated and @scope. Sort with optimal, popularity, quality or maintenance, or set the quality, popularity and maintenance weights between 0 and 1. Limit is 1 to 250 per page. The registry honours a starting offset only up to 5,000, so the deepest result is about 5,250 and a page past it is an empty page with hasMore: false. A search that matches nothing returns found with an empty list.

npm Search API FAQ

Which qualifiers can I put in the query?

npm's standard qualifiers: author:name, maintainer:name, keywords:a,b, not:deprecated, not:unstable, is:unstable and @scope. Combine them with plain words, for example keywords:cli not:deprecated.

How deep can I page?

The registry accepts a starting offset up to 5,000, so with the maximum 250 per page the deepest result is about 5,250. A page that would start past 5,000 returns an empty list with hasMore false, not an error. For a broad topic, narrow the query instead of paging deeper.

What is in the score object?

score.final, score.quality, score.popularity and score.maintenance are npm's 0 to 1 component scores. searchScore is the ranking number npm used for this query. Use sort to choose a single component, or explicit weights for a custom blend.

Can I sort by downloads?

Not directly. Each result carries downloads.weekly and downloads.monthly, and sort=popularity uses npm's popularity component. To rank by downloads yourself, fetch a page and sort the rows in your own code.

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.