# npm & PyPI Package Health Check (`sterlingverify/package-health-check`) Actor

Check npm and PyPI packages in bulk: known vulnerabilities (OSV.dev), licence, latest version and release date, deprecation, downloads and maintainers. Get an OK / REVIEW / RISK verdict per package for software supply-chain, vendor due diligence and security reviews.

- **URL**: https://apify.com/sterlingverify/package-health-check.md
- **Developed by:** [Luke Mangan](https://apify.com/sterlingverify) (community)
- **Categories:** Developer tools, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 package checkeds

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 & PyPI Package Health Check

**npm & PyPI Package Health Check** checks npm and PyPI packages in bulk for known vulnerabilities (OSV.dev), licence, latest version and release date, deprecation, downloads and maintainers, with an OK / REVIEW / RISK verdict per package.

**Best for:** Software supply-chain reviews, vendor due diligence, security questionnaires and keeping an eye on dependencies on a schedule.

### How to check npm and PyPI packages for vulnerabilities

1. Add packages to **Packages**: `npm:lodash`, `PyPI:django` or `{"ecosystem": "npm", "name": "axios", "version": "0.21.0"}`.
2. Click **Start**.
3. Filter on `health` and `riskFlags` to find packages to review.

### How it works

Uses the public npm registry and download-count APIs, the PyPI JSON API and the OSV.dev vulnerability database (Google's open-source database, data under CC-BY 4.0), all without keys. Flags: KNOWN_VULNERABILITIES, DEPRECATED, NO_RELEASE_2Y, NO_LICENSE_DECLARED, OUTDATED. Unknown packages or bad rows return `ok: false` and are not charged.

### Output

`ecosystem, name, checkedVersion, latestVersion, health, riskFlags, vulnerabilityCount, vulnerabilities, license, daysSinceLatestRelease, ok`

### Pricing (pay-per-event)

- `package-checked`: **$0.0005** per result ($0.5 / 1,000). Platform usage is included; you pay only for results.
- Example: 10,000 packages cost $5.00.

### Example input

```json
{
  "packages": [
    "npm:lodash",
    "PyPI:django",
    {
      "ecosystem": "npm",
      "name": "axios",
      "version": "0.21.0"
    }
  ]
}
```

### Example output

Values below are illustrative.

```json
{
  "ecosystem": "PyPI",
  "name": "requests",
  "checkedVersion": "2.19.0",
  "latestVersion": "2.34.2",
  "health": "RISK",
  "riskFlags": [
    "KNOWN_VULNERABILITIES",
    "OUTDATED"
  ],
  "vulnerabilityCount": 5,
  "vulnerabilities": [],
  "license": "Apache-2.0",
  "daysSinceLatestRelease": 152,
  "ok": true
}
```

### Use it via API, schedules and integrations

Run it in Apify Console, or call it from your own code with the Apify API or the Python and JavaScript clients. Save an input as a task and add a schedule to run it regularly, and send results to Slack, email, webhooks, Zapier, Make or n8n with Apify integrations. AI agents can find and run it through the Apify MCP server.

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("sterlingverify/package-health-check").call(run_input={"packages": ["npm:lodash", "PyPI:django"]})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

### FAQ

#### Where does the vulnerability data come from?

OSV.dev, Google's open-source vulnerability database (CC-BY 4.0), plus the public npm and PyPI APIs. No keys needed.

#### Is this a full security audit?

No. Vulnerability data can lag, and it doesn't know whether your code uses the affected function.

### Disclaimer

An automated aid, not a full security audit: vulnerability data can lag and doesn't account for whether your code actually uses the affected function. Not affiliated with npm, PyPI, the PSF or OSV.

### Related sterlingVerify tools

Part of the sterlingVerify UK payments, KYB and data toolkit on Apify Store:

- [SSL Certificate Expiry Monitor](https://apify.com/sterlingverify/ssl-expiry-monitor): bulk SSL certificate expiry checks and alerts
- [PSP Status Monitor](https://apify.com/sterlingverify/psp-status-monitor): outage alerts from payment provider status pages
- [Structured Data Extractor](https://apify.com/sterlingverify/schema-org-extractor): schema.org JSON-LD and Open Graph data from any page

# Actor input Schema

## `packages` (type: `array`):

List of {ecosystem: npm or PyPI, name, version (optional, default latest)}, or strings like "npm:express" / "PyPI:requests".

## Actor input object example

```json
{
  "packages": [
    {
      "ecosystem": "npm",
      "name": "express"
    },
    {
      "ecosystem": "PyPI",
      "name": "requests",
      "version": "2.19.0"
    }
  ]
}
```

# Actor output Schema

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

All results in the default dataset

# 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 = {
    "packages": [
        {
            "ecosystem": "npm",
            "name": "express"
        },
        {
            "ecosystem": "PyPI",
            "name": "requests",
            "version": "2.19.0"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sterlingverify/package-health-check").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 = { "packages": [
        {
            "ecosystem": "npm",
            "name": "express",
        },
        {
            "ecosystem": "PyPI",
            "name": "requests",
            "version": "2.19.0",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("sterlingverify/package-health-check").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 '{
  "packages": [
    {
      "ecosystem": "npm",
      "name": "express"
    },
    {
      "ecosystem": "PyPI",
      "name": "requests",
      "version": "2.19.0"
    }
  ]
}' |
apify call sterlingverify/package-health-check --silent --output-dataset

```

## MCP server setup

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

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/Ypxzz0BvDSXBqfo8I/builds/KmQizvv6OXVXm3WjS/openapi.json
