npm Bulk Downloads API
One request for up to 128 package names, in request order, with a per-name status so one bad name does not spoil the batch.
GET /v1/npm/packages/downloads1 credit per name Up to 128 names per request Max 128 credits A name that is not found is still charged Failed requests are free
About this endpoint
GET /v1/npm/packages/downloads?names=express,react,lodash&period=last-week returns data.results, one row per requested name in request order. Each row has name, status, start, end, total and days. status is found when npm has data for the name, not_found when the package does not exist on npm, and unavailable when that name's data was temporarily unavailable. data.summary counts requested, found, notFound and unavailable.
Names can be comma-separated or repeated, and duplicates are dropped. Scoped names are accepted and looked up one at a time, up to 20 per batch. Give period, or from and to, and add granularity=daily for day rows per name. The batch charges one credit per requested name, so a 20-name batch is 20 credits.
npm Bulk Downloads API FAQ
How many names can one batch take?
Up to 128 distinct names, and at most 20 of them scoped. Duplicates are removed before billing, so asking for the same name twice costs one credit. Longer lists are refused with HTTP 400; split them into several requests.
How is an unavailable name different from not_found?
not_found means the package does not exist on npm. unavailable means that name's data was temporarily unavailable; a later request usually fills it. The batch still returns the other names.
What do daily results look like in a batch?
With granularity=daily each result carries days, one row of day and downloads, and total is null. With the default total granularity each result carries total and days is null.
What does a batch 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. This batch charges 1 credit per requested name, including a name that is not found, up to 128 names and 128 credits per request. Duplicates count once.
Other npm endpoints
- PackageGET /v1/npm/package
- Package detailsGET /v1/npm/package/details
- VersionsGET /v1/npm/package/versions
- VersionGET /v1/npm/package/version
- DownloadsGET /v1/npm/package/downloads
- Downloads by versionGET /v1/npm/package/downloads/versions
- AdvisoriesGET /v1/npm/package/advisories
- ProvenanceGET /v1/npm/package/provenance