npm

Get npm downloads for several packages

Get npm downloads for up to 128 package names in one call, one result per requested name.

GET/v1/npm/packages/downloads
x-api-keystringheader

API key (`sfk_...`)

Parameters
5
namesarrayrequiredquery

Comma-separated package names, 1 to 128, with at most 20 scoped names because each one is looked up separately.

periodstringoptionalquery

Window: `last-day`, `last-week`, `last-month` or `last-year`. Default: `last-week` unless `from`/`to` are given.

one of: last-day, last-week, last-month, last-year

fromstringoptionalquery

First day of the range, `YYYY-MM-DD`. Download data starts on 2015-01-10; a `from` after today is refused. A range spans up to 18 months; a longer range keeps its newest 18 months and sets `clamped`.

tostringoptionalquery

Last day of the range, `YYYY-MM-DD`. Must be on or after `from`; a `to` before 2015-01-10 is refused. A range spans up to 18 months; a longer range keeps its newest 18 months and sets `clamped`.

granularitystringoptionalquery

`total` for one number, `daily` for one row per day. Default: `total`.

one of: total, daily

Response fields
25

Endpoint-specific response payload.

One row per requested name, in request order.

dataresults[]name
string

Requested package name.

dataresults[]status
string

`found` with data, `not_found` when npm says the package does not exist, `unavailable` when that name's data was temporarily unavailable.

one of: found, not_found, unavailable

dataresults[]start
stringnullable

First day of the counted range.

dataresults[]end
stringnullable

Last complete day of the counted range.

dataresults[]total
integernullable

Downloads for a total answer; null otherwise.

≥ 0

One row per day for a daily answer; null otherwise.

dataresults[]days[]day
string

Day, `YYYY-MM-DD`.

dataresults[]days[]downloads
integer

Downloads that day.

≥ 0

Counts over the requested names.

datasummaryrequested
integer

Names requested.

≥ 0

datasummaryfound
integer

Names with data.

≥ 0

datasummarynotFound
integer

Names npm does not have.

≥ 0

datasummaryunavailable
integer

Names whose data was temporarily unavailable.

≥ 0

Pagination state for this page.

datapagehasMore
boolean

Whether another page is available.

datapagenextCursor
stringnullable

Opaque cursor for the next request; null on the last page.

datapagepage
integeroptional

The 1-based page number of this response, when numbered.

≥ 0

datapageperPage
integeroptional

Rows per page, when fixed.

≥ 0

datapagetotal
integernullableoptional

Total rows, or null when npm does not publish one.

≥ 0

Metadata describing the request and billing outcome.

metarequestId
string

Unique request identifier for tracing this API call.

min 1 chars

metacreditsCharged
integer

Credits charged for this request.

≥ 0

metaversion
string

Public API version that served the response.

one of: v1

Code example

curl "https://api.socialfetch.dev/v1/npm/packages/downloads?names=express,react,lodash" \
  -H "x-api-key: YOUR_API_KEY"

Responses

npm downloads by name.