# npm Package Version Delta Monitor (`collinjreynolds/npm-package-version-delta-monitor`) Actor

Monitors public npm packages for new versions via the official registry API and emits only deltas. First run baselines without charging. PPE event: version-delta.

- **URL**: https://apify.com/collinjreynolds/npm-package-version-delta-monitor.md
- **Developed by:** [Collin Reynolds](https://apify.com/collinjreynolds) (community)
- **Categories:** Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 new npm package versions

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## npm Package Version Delta Monitor

Watch public **npm packages** for **new versions** via the official registry API (`registry.npmjs.org`). Only **deltas** since the last run are written to the dataset — ideal for dependency monitoring, SBOM/ops agents, and scheduled changelogs.

**Pricing (pay per event):** **`$0.001` per `version-delta`** (each newly detected package version). Actor start is a small platform event (~`$0.00005`). First run baselines quietly (0 dataset items / 0 delta charges) so you are not billed for history.

### Why use this

- **API-only** — official npm registry JSON (no HTML scraping)
- **Delta-only** — subsequent runs emit new versions only
- **First-run safe** — empty state seeds `LAST_SEEN` with zero PPE delta charges
- **No auth required** for public packages
- **Schedule-friendly** — pair with an Apify schedule for continuous monitoring
- **Scoped packages** supported (`@scope/name`)

### Input

| Field | Required | Description |
|-------|----------|-------------|
| `packages` | yes | List of npm package names (incl. scoped) |
| `sinceVersion` | no | On first run for a package, treat this version and older (by publish time) as already seen |
| `includePrereleases` | no | Include semver prereleases (default true) |
| `resetState` | no | Clear `LAST_SEEN` and re-baseline (0 emits that run) |

#### Example

```json
{
  "packages": ["lodash", "axios", "@apify/utilities"],
  "includePrereleases": true,
  "resetState": false
}
```

### Output

Each dataset item is a newly detected version, for example:

- `package`, `version`, `published_at`, `package_description`, `is_prerelease`, `is_latest`, `registry_url`, `tarball_url`

### First-run behavior

| Situation | Dataset items | `version-delta` charges |
|-----------|---------------|-------------------------|
| Empty state, no `sinceVersion` | **0** | **0** (baseline only) |
| Empty state + `sinceVersion` | Only newer than that version | 1 per item |
| Later runs | New version strings only | 1 per item |

### Tips

1. Run once to baseline, then attach a **schedule** (e.g. hourly/daily).
2. Keep package lists focused — each packument fetch is one HTTP GET.
3. Set a user **max total charge** on the run so costs stay predictable.

### ToS / scope

Uses the public npm registry REST API only. See [AGREEMENT.md](./AGREEMENT.md). Respect npm registry terms and fair use.

# Actor input Schema

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

List of public npm package names (supports scoped packages like @scope/name).

## `sinceVersion` (type: `string`):

If set and no LAST\_SEEN snapshot exists for a package, treat this version (and older by publish time) as already seen so only newer versions are emitted.

## `includePrereleases` (type: `boolean`):

If false, skip semver prerelease versions (those with a hyphen, e.g. 1.0.0-beta.1).

## `resetState` (type: `boolean`):

If true, ignore and clear the stored LAST\_SEEN fingerprint map before this run.

## Actor input object example

```json
{
  "packages": [
    "lodash",
    "axios",
    "@apify/utilities"
  ],
  "includePrereleases": true,
  "resetState": false
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset items for newly detected versions (package, version, published\_at, etc.). First run baselines with 0 items.

# 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": [
        "lodash",
        "axios",
        "@apify/utilities"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("collinjreynolds/npm-package-version-delta-monitor").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": [
        "lodash",
        "axios",
        "@apify/utilities",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("collinjreynolds/npm-package-version-delta-monitor").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": [
    "lodash",
    "axios",
    "@apify/utilities"
  ]
}' |
apify call collinjreynolds/npm-package-version-delta-monitor --silent --output-dataset

```

## MCP server setup

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

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/ZBq7e6C6OyL5fSvGi/builds/49iUXC3jqfudyRFN1/openapi.json
