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

- Page: https://fous.com/methods/npmjs.com/get-download-stats
- Method: `npmjs.com/get_download_stats`, version 1
- Website: npmjs.com
- Returns: package, package_url, start_date, end_date, total_downloads, downloads by day or week
- Effect: read (it gets data and changes nothing)
- Sign-in: none needed
- Cost: 1 credit per completed run (1¢ with pay as you go); failed runs are free
- Verified: Nov 2, 2026

## Inputs

| Field | Type | Required | In the run below | Description |
|---|---|---|---|---|
| `period` | string | no |  | The time period, such as last_month. One of "last_week", "last_month", "last_year". Default "last_month". |
| `package` | string | yes | `"express"` | The npm package name, such as express or @types/node. |
| `breakdown` | string | no |  | Group counts by day or Monday-start week, such as day. One of "day", "week". Default "day". |

## Output

From a run on Oct 23, 2026, shortened. Its input:

```json
{
  "package": "express"
}
```

Its output:

```json
{
  "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
}
```

## Run it

From code, with a Fous API key in `FOUS_API_KEY`; the answer's `data` holds the output:

```bash
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"}}'
```

From an AI agent connected to the Fous MCP server: its `run` with the same method and input. To connect one, give it `set up https://fous.com/SKILL.md`.

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

## Input schema

```json
{
  "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

```json
{
  "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
}
```

## See more

- [npm API: Get package](https://fous.com/methods/npmjs.com/get-package.md): Looks up a public npm package by name or npm link. Returns its latest version, weekly downloads, maintainers, links, dates and version count.
- [npm API: Search packages](https://fous.com/methods/npmjs.com/search-packages.md): Searches 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.
- [NuGet API: Get package](https://fous.com/methods/nuget.org/get-package.md): Looks 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.
- [Wikipedia API: Get page views](https://fous.com/methods/wikipedia.org/get-page-views.md): Returns human-reader view counts for a Wikipedia article by day or month, with totals, daily averages and the peak period.
- [Stock Analysis API: Get financial statements](https://fous.com/methods/stockanalysis.com/get-financial-statements.md): Looks 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.
- [PyPI API: Get package](https://fous.com/methods/pypi.org/get-package.md): Gets 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.
- [RubyGems API: Get a Ruby gem's details](https://fous.com/methods/rubygems.org/get-gem.md): Looks 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.
- [GitHub API: List trending repositories](https://fous.com/methods/github.com/list-trending-repositories.md): Lists up to 25 public repositories trending on GitHub, in page order, optionally filtered by programming language and time period.
- [All npm methods](https://fous.com/methods/npmjs.com.md)
