npm API: Get download stats
Returns total and daily or Monday-start weekly npm downloads for a package over the last week, month, or year.
Unofficial. Not affiliated with or endorsed by npm.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Period optional
period The time period, such as last_month.
last_month (default)
One of
last_week,last_month,last_year.- Package, required
package The npm package name, such as express or @types/node.
express
- Breakdown optional
breakdown Group counts by day or Monday-start week, such as day.
day (default)
One of
day,week.
Input as JSON
{ "package": "express"}Output
{ "package": "express", "end_date": "2026-10-18", "downloads": [ { "date": "2026-09-19", "download_count": 13679155 }, { "date": "2026-09-20", "download_count": 13971133 }, { "date": "2026-09-21", "download_count": 25107465 } ], "start_date": "2026-09-19", "package_url": "https://www.npmjs.com/package/express" , "total_downloads": 585410126}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"npmjs.com/get_download_stats","input":{"package":"express"}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "npmjs.com/get_download_stats" , "input": { "package": "express" }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "npmjs.com/get_download_stats" , "input": { "package": "express" } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run npmjs.com/get_download_stats# with {"package":"express"}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "package" ], "properties": { "period": { "enum": [ "last_week", "last_month", "last_year" ], "type": "string", "default": "last_month", "description": "The time period, such as last_month." }, "package": { "type": "string", "minLength": 1, "description": "The npm package name, such as express or @types/node." }, "breakdown": { "enum": [ "day", "week" ], "type": "string", "default": "day", "description": "Group counts by day or Monday-start week, such as day." } }}Output schema
{ "type": "object", "required": [ "package", "package_url", "start_date", "end_date", "total_downloads", "downloads" ], "properties": { "package": { "type": "string", "description": "The npm package name." }, "end_date": { "type": "string", "format": "date", "description": "Last day included in the period." }, "downloads": { "type": "array", "items": { "type": "object", "required": [ "date", "download_count" ], "properties": { "date": { "type": "string", "format": "date", "description": "Day, or Monday starting the week." }, "download_count": { "type": "integer", "description": "Downloads on this day or within this week and the chosen period." } }, "additionalProperties": false }, "description": "Counts in chronological order. A weekly date is the Monday of that week." }, "start_date": { "type": "string", "format": "date", "description": "First day included in the period." }, "package_url": { "type": "string", "description": "The npm package page." }, "total_downloads": { "type": "integer", "description": "Total downloads in the period." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
npmjs.com/get_download_stats- Returns
- package, package_url, start_date, end_date, total_downloads, downloads by day or week
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method npmjs.com/get_download_stats with the inputs above.
Ask your agent
- How many times was the express package downloaded last month, broken down by day?
- Show weekly download totals for @types/node over the past year from npmjs.com
- What were the npm download counts for lodash last week?
- I need total downloads for react-dom for the last year, grouped by Monday-start weeks.
- Get the daily npm download figures for typescript covering last month.
See more
All npm methodsLooks up a public npm package by name or npm link. Returns its latest version, weekly downloads, maintainers, links, dates and version count.
npmjs.com/get_packageSearches the npm registry for JavaScript packages by description or keywords, in npm's search order, and returns each package's latest version, weekly downloads and publish date.
npmjs.com/search_packagesLooks up a NuGet package by name or nuget.org link. Inexact names match the top search result. Returns the latest stable release's details and the 10 most recent versions, including prereleases.
nuget.org/get_packageReturns human-reader view counts for a Wikipedia article by day or month, with totals, daily averages and the peak period.
wikipedia.org/get_page_viewsLooks up a company by name or ticker on Stock Analysis and returns its annual or quarterly income statement, balance sheet, or cash flow statement for the free periods.
stockanalysis.com/get_financial_statementsGets a PyPI package's current version, release date, metadata, project links and its 10 most recently published versions from a package name or PyPI link.
pypi.org/get_packageLooks up a Ruby gem on RubyGems by name or gem page link and returns its latest version, release date, description, downloads, authors, license, links and runtime dependencies.
rubygems.org/get_gemLists up to 25 public repositories trending on GitHub, in page order, optionally filtered by programming language and time period.
github.com/list_trending_repositories