npm

Get npm package downloads

Get npm downloads for a package over a period or a day range, or the whole registry's total.

GET/v1/npm/package/downloads
1credit
x-api-keystringheader

API key (`sfk_...`)

Parameters
5
namestringquery

Package name. Omit it for the whole registry's download total.

max 214 chars

periodstringquery

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

fromstringquery

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`.

tostringquery

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`.

granularitystringquery

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

one of: total, daily

Response fields
15

Endpoint-specific response payload.

datalookupStatus
string

Whether the item exists. Every outcome is HTTP 200; branch on this field.

one of: found, not_found

dataname
stringnullable

Package name, or null for the registry total.

datagranularity
string

The shape of this answer.

one of: total, daily

datatotal
integernullable

Downloads in the window for a total answer; null for daily.

≥ 0

datastart
stringnullable

First day of the counted range.

dataend
stringnullable

Last complete day of the counted range.

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

datadays[]day
string

Day, `YYYY-MM-DD`.

datadays[]downloads
integer

Downloads that day.

≥ 0

dataclamped
boolean

True when the returned range is narrower than the requested range, for example when it was longer than 18 months or began before 2015-01-10.

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/package/downloads?name=express&period=last-week" \
  -H "x-api-key: YOUR_API_KEY"

Responses

npm downloads.