# npm Package API — Downloads, Deps & Health Score (`lmhsolutions/npm-package-intelligence`) Actor

Search npm or look up exact packages and enrich with registry metadata plus official download counts (day/week/month/year), dependency counts, maintainers, and a maintenance health score. Scoped packages supported. No API key.

- **URL**: https://apify.com/lmhsolutions/npm-package-intelligence.md
- **Developed by:** [LMH Solutions](https://apify.com/lmhsolutions) (community)
- **Categories:** Developer tools, AI, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 npm packages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## npm Package Intelligence — Registry, Downloads & Health Scores

**SEO title:** npm Package Scraper | Downloads, Dependencies, Maintainers & Health Score\
**SEO description:** Search npm or look up exact packages. Get official download counts, dependencies, publish recency, maintainers, and a maintenance health score. Scoped packages supported. No API key.

Turn the public npm registry + download APIs into a clean Apify dataset for supply-chain reviews, competitor package tracking, SEO/dev-tool research, and agent workflows.

### Why this beats typical Store competitors

Existing npm Actors on the Store mostly have ~3 users and stop at shallow metadata. This Actor:

- Combines **search + exact package lookup** (including **scoped** packages like `@types/node`)
- Pulls **official** `api.npmjs.org` download points: last-day / week / month / year
- Enriches with **packument** data: version count, dist-tags, dependency counts, publish timestamps, deprecation
- Computes a transparent **healthScore** (popularity + publish freshness + maintainers + repo presence − huge dep trees)
- Optional **per-version last-week downloads**
- Exposes npm search quality / popularity / maintenance weights

### Example input

```json
{
  "mode": "both",
  "query": "http client",
  "packageNames": ["express", "lodash", "@types/node"],
  "maxResults": 10,
  "includePackument": true,
  "includeDownloads": true
}
```

### Example output (truncated)

```json
{
  "name": "express",
  "version": "5.3.0",
  "license": "MIT",
  "downloadsLastDay": 25000000,
  "downloadsLastWeek": 194000000,
  "downloadsLastMonth": 571000000,
  "dependenciesCount": 30,
  "maintainersCount": 5,
  "daysSincePublish": 25,
  "healthScore": 91.4,
  "repositoryUrl": "https://github.com/expressjs/express",
  "npmUrl": "https://www.npmjs.com/package/express",
  "source": "npmjs.com"
}
```

### Suggested pay-per-event pricing

| Event | Suggested price |
| --- | --- |
| Actor start | $0.0005 |
| Per enriched package | **$0.003 – $0.008** |

Enrichment hits several endpoints per package, so price above plain search scrapers. Start around **$0.005 / package**.

### Data sources & limits

- Registry: https://registry.npmjs.org (see npm registry API docs)
- Downloads: https://api.npmjs.org/downloads/...
- Download stats update after UTC midnight processing; bursts may 429 — Actor logs warnings and continues.
- Not affiliated with npm, Inc.

### Changelog

- **1.0.0** — Search + packument + official downloads + health score + scoped package support.

### Use cases

- **Engineering / AppSec** — score critical package.json deps for download volume, publish freshness, and maintainer count.
- **OSS maintainers** — compare similar packages before adopting a dependency.
- **Supply-chain monitors** — scheduled health checks on a fixed package list.
- **Apify MCP / agents** — returns structured healthScore + download points agents can threshold on.

**Buyer task:** `eng-npm-critical-deps-health`.
**Examples:** https://github.com/LMH-Solutions/apify-open-data-actors (examples/npm_health_check.py)

# Actor input Schema

## `mode` (type: `string`):

search = npm registry search; packages = enrich an exact package name list; both = search then also enrich packageNames.

## `query` (type: `string`):

npm search text (keywords, package names). Supports npm qualifiers like keywords:http author:sindresorhus.

## `packageNames` (type: `array`):

Exact package names to enrich, including scoped packages (e.g. express, @types/node).

## `maxResults` (type: `integer`):

Maximum packages to return from search (1–250 per page; Actor paginates).

## `popularity` (type: `number`):

0–1 weight for npm search ranking by popularity.

## `quality` (type: `number`):

0–1 weight for npm search ranking by quality.

## `maintenance` (type: `number`):

0–1 weight for npm search ranking by maintenance.

## `includePackument` (type: `boolean`):

Fetch registry.npmjs.org/{package} for dependencies, version count, dist-tags, and publish times.

## `includeDownloads` (type: `boolean`):

Fetch api.npmjs.org download points for last-day / week / month / year.

## `includeVersionDownloads` (type: `boolean`):

Also fetch last-week downloads by version (top versions kept).

## Actor input object example

```json
{
  "mode": "both",
  "query": "http client",
  "packageNames": [
    "express",
    "lodash",
    "@types/node"
  ],
  "maxResults": 10,
  "popularity": 1,
  "quality": 0.5,
  "maintenance": 0.5,
  "includePackument": true,
  "includeDownloads": true,
  "includeVersionDownloads": false
}
```

# Actor output Schema

## `results` (type: `string`):

Items written to the default dataset via Actor.push_data().

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "both",
    "query": "http client",
    "packageNames": [
        "express",
        "lodash",
        "@types/node"
    ],
    "maxResults": 10,
    "includePackument": true,
    "includeDownloads": true,
    "includeVersionDownloads": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("lmhsolutions/npm-package-intelligence").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "both",
    "query": "http client",
    "packageNames": [
        "express",
        "lodash",
        "@types/node",
    ],
    "maxResults": 10,
    "includePackument": True,
    "includeDownloads": True,
    "includeVersionDownloads": False,
}

# Run the Actor and wait for it to finish
run = client.actor("lmhsolutions/npm-package-intelligence").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "both",
  "query": "http client",
  "packageNames": [
    "express",
    "lodash",
    "@types/node"
  ],
  "maxResults": 10,
  "includePackument": true,
  "includeDownloads": true,
  "includeVersionDownloads": false
}' |
apify call lmhsolutions/npm-package-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lmhsolutions/npm-package-intelligence"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/14TroPzyisMCjgyWO/builds/ijy78TL8bC8OZt7eF/openapi.json
