# Dataset Diff & Change Detector (Added / Removed / Modified) (`forgekit/dataset-diff-change-detector`) Actor

Compare Apify Datasets, CSV/JSON/XLSX snapshots, or automatic stateful baselines to detect added, removed, and field-level modified rows with numeric % deltas, plain-English summaries, and Standby MCP.

- **URL**: https://apify.com/forgekit/dataset-diff-change-detector.md
- **Developed by:** [James Edmans](https://apify.com/forgekit) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.21 / 1,000 unique records key compared

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/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

## Dataset Diff & Change Detector (Added / Removed / Modified)

> **Apify Store Actor:** `forgekit/dataset-diff-change-detector` | **Runtime:** Node.js 22 (lightweight deterministic diff engine, 256–1024 MB RAM) | **Billing:** Pay-Per-Event (PPE) + Standby MCP Server

### Overview

**Dataset Diff & Change Detector** compares any two snapshots — Apify Datasets, CSV/TSV/JSON/NDJSON/XML/XLSX file URLs, or inline JSON arrays — OR runs in **one-click Stateful Snapshot Mode**, automatically persisting each run's baseline in a named Key-Value Store so scheduled monitors detect `added`, `removed`, and field-level `modified` records with zero glue code.

Built for price-drop tracking, competitor catalog monitoring, job-board deltas, SaaS directory changes, and AI monitoring agents, it computes exact **numeric and percentage deltas** (including currency strings like `"$1,299.50"` and safe divide-by-zero handling), suppresses noisy scraper jitter, emits **plain-English `changeSummary` sentences** ready for Slack/email/n8n alerts, generates a Markdown changelog (`DIFF_REPORT_MD`), and protects your saved baseline with an **Atomic Snapshot Guard**.

### Features vs Competitors

- **Field-Level Delta Engine with Numeric & Percent Math:** Computes exact `before`, `after`, `changeType` (`updated`, `type-changed`, `added-field`, `removed-field`), `numericDelta`, and `percentChange` across nested dot-notation objects (`pricing.monthly`).
- **Voice-of-Customer Monitoring Upgrades:**
  - **Human-Readable `changeSummary` Per Row:** Emits plain-English alert copy (e.g. `"inStock changed false -> true; price decreased -20.0% (99 -> 79.2)"`) ready to drop straight into Slack, Discord, email, or n8n without custom Jinja/JS parsing.
  - **Zero-Noise Smart Defaults:** Automatically ignores volatile scraper metadata (`scrapedAt`, `timestamp`, `crawledAt`, `runId`) and supports `numericTolerance`, `minPercentChange`, `ignoreCaseAndWhitespace`, and `ignoreArrayOrder`.
  - **Quiet No-Changes Alerting (`webhookSkipIfNoChanges: true`):** Never spams webhooks when `totalChanges === 0`, while writing an explicit `SUMMARY.statusMessage` (`"No changes detected across N compared records"`) so quiet runs are clearly distinguished from errors.
  - **Atomic Snapshot Guard (`allowEmptyBaselineOverwrite: false`):** Refuses to overwrite an existing non-empty stateful baseline when an upstream scraper accidentally returns `0` rows — preventing false 100%-removed alert storms and recording `SUMMARY.snapshotProtected: true`.
- **Markdown Changelog (`DIFF_REPORT_MD`) + Webhook Alerting:** Generates a clean summary table in KV storage and optionally posts concise JSON alerts to any SSRF-validated webhook URL.

| Capability | Dataset Diff & Change Detector | `nerolabs/dataset-filter-transform` | Vertical-Specific Trackers |
|---|---|---|---|
| Added + Removed + Modified Field Diffs | Full (`added`, `removed`, `modified`, `unchanged`) | `onlyNew` only (no removed/modified!) | Single site hardcoded |
| Numeric & `%` Price-Drop Math | Built-in (`numericDelta`, `percentChange`, currency parsing) | None | None |
| Price per 1,000 Records (FREE) | **$0.30** (`$0.0003/record`) | $2.00 (6.6x pricier!) | Varies |
| Atomic Empty-Scrape Baseline Guard | Built-in (`snapshotProtected: true`) | None | None |
| Plain-English `changeSummary` + MD Report | Built-in per row + `DIFF_REPORT_MD` | None | None |
| Standby MCP Server | Native JSON-RPC 2.0 + SSE (2 tools) | None | None |

### Input Configuration

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `mode` | `string` | No | `"two-source"` | `"two-source"` (explicit A vs B) or `"stateful-snapshot"` (auto-persisted baseline). |
| `baselineDatasetId` | `string` | No | `""` | Apify Dataset ID for baseline (previous) snapshot. |
| `currentDatasetId` | `string` | No | `""` | Apify Dataset ID for current (latest) snapshot. |
| `baselineFileUrl` | `string` | No | `""` | Public CSV/JSON/NDJSON/XLSX URL for baseline snapshot (SSRF-protected). |
| `currentFileUrl` | `string` | No | `""` | Public CSV/JSON/NDJSON/XLSX URL for current snapshot (SSRF-protected). |
| `baselineRows` | `object[]` | No | `[]` | Inline JSON baseline records (up to 50,000). |
| `currentRows` | `object[]` | No | `[]` | Inline JSON current records (up to 50,000). |
| `snapshotStoreName` | `string` | No | `"dataset-diff-snapshots"` | Named KV store persisting baselines in `stateful-snapshot` mode. |
| `snapshotKey` | `string` | No | `"default-baseline"` | Snapshot identifier inside `snapshotStoreName`. |
| `updateSnapshot` | `boolean` | No | `true` | Atomically save `currentRows` as next run's baseline (set `false` for dry-run). |
| `emitInitialBaselineAsAdded` | `boolean` | No | `false` | Emit first stateful baseline rows as `"added"` (false prevents initial alert flood). |
| `keyFields` | `string[]` | No | `["id"]` | Primary key field(s) matching records across snapshots (`1`–`10` fields). |
| `trackFields` | `string[]` | No | `[]` | Explicit allowlist of fields to compare (empty compares all non-ignored fields). |
| `ignoreFields` | `string[]` | No | `["scrapedAt","timestamp","crawledAt","runId"]` | Volatile metadata columns ignored during comparison. |
| `includeStatuses` | `string[]` | No | `["added","removed","modified"]` | Categories to push to output dataset (`"added"`, `"removed"`, `"modified"`, `"unchanged"`). |
| `numericTolerance` | `number` | No | `0` | Ignore numeric differences with `abs(after - before) <= numericTolerance`. |
| `minPercentChange` | `number` | No | `0` | Only flag numeric moves whose absolute percentage change is `>= minPercentChange`. |
| `ignoreCaseAndWhitespace` | `boolean` | No | `false` | Normalize string casing and collapse whitespace before equality comparison. |
| `ignoreArrayOrder` | `boolean` | No | `false` | Treat arrays as unordered multisets so reordered tags don't trigger false diffs. |
| `webhookUrl` | `string` | No | `""` | Optional SSRF-validated webhook URL receiving change alert JSON payloads. |
| `webhookSkipIfNoChanges` | `boolean` | No | `true` | Skip dispatching `webhookUrl` when `totalChanges === 0`. |
| `allowEmptyBaselineOverwrite` | `boolean` | No | `false` | Keep `false` to prevent an empty upstream scrape from wiping a saved baseline. |
| `maxRows` | `integer` | No | `100000` | Hard safety cap on rows compared per side (`1`–`500,000`). |

### Output Example

Captured directly from a local end-to-end test run comparing two SKU snapshots (`sku-4821` price drop `-20.0%` + restocked, `scrapedAt` automatically ignored):

```json
{
  "changeType": "modified",
  "recordKey": "sku-4821",
  "keyValues": {
    "sku": "sku-4821"
  },
  "changedFields": [
    "inStock",
    "price"
  ],
  "changeSummary": "inStock changed false -> true; price decreased -20.0% (99 -> 79.2)",
  "changes": [
    {
      "field": "inStock",
      "before": false,
      "after": true,
      "changeType": "updated"
    },
    {
      "field": "price",
      "before": 99,
      "after": 79.2,
      "changeType": "updated",
      "numericDelta": -19.8,
      "percentChange": -20
    }
  ],
  "before": {
    "sku": "sku-4821",
    "price": 99,
    "inStock": false,
    "scrapedAt": "2026-11-30T10:00:00Z"
  },
  "after": {
    "sku": "sku-4821",
    "price": 79.2,
    "inStock": true,
    "scrapedAt": "2026-12-01T10:00:00Z"
  },
  "detectedAt": "2026-12-01T20:47:51.802Z"
}
```

### Pay-Per-Event (PPE) Pricing

| Event Key | Event Title | Price (USD) | Billing Trigger |
|---|---|---:|---|
| `actor-start` | Actor run start | `$0.005` | Charged once on non-empty diff runs (waived on empty/protected runs). |
| `row-compared` | Unique record key compared | `$0.0003` | Charged per unique primary key compared across baseline and current snapshots. |
| `webhook-sent` | Optional change alert webhook dispatched | `$0.005` | Charged only when a webhook notification is actually sent. |
| `mcp-tool-call` | Standby MCP tool execution | `$0.003` | Charged per successful Standby MCP JSON-RPC tool invocation. |

**Cost Example:** Comparing `1,000` unique product records with 1 change webhook costs `$0.005 + (1,000 × $0.0003) + $0.005 = $0.31 USD` (6.6× cheaper than `nerolabs/dataset-filter-transform`).

### Standby MCP Server & AI Agent Integration

Enable Apify Standby Mode (`APIFY_META_ORIGIN=STANDBY`) to connect `forgekit/dataset-diff-change-detector` directly to Claude Desktop, Cursor, or any MCP client:

- **Health Endpoint:** `GET /health`
- **MCP Endpoint:** `POST /mcp` and `GET /mcp` (Streamable HTTP + SSE)
- **Exposed MCP Tools:**
  - `diff_datasets` — Compares `baselineRows` vs `currentRows` by primary key(s), emitting `added`, `removed`, `modified` (with numeric `%` deltas & `changeSummary`), and optional `unchanged`.
  - `detect_field_changes` — Focused numeric/price/status threshold detector returning only rows whose tracked fields moved beyond `minPercentChange` or `minAbsoluteChange`.

```json
{
  "mcpServers": {
    "dataset-diff-change-detector": {
      "url": "https://forgekit--dataset-diff-change-detector.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

### Error Handling, Rate Limits & Limitations

- **SSRF & Path-Traversal Protection:** All `baselineFileUrl`, `currentFileUrl`, and `webhookUrl` inputs enforce `http:`/`https:` schemes only and block loopback, RFC 1918 private IPs, and cloud metadata (`169.254.169.254`). `snapshotKey` rejects path traversal (`..`, `/`, `\`).
- **Duplicate Primary Keys:** If a snapshot contains duplicate `keyFields`, the last occurrence deterministically wins and `SUMMARY.duplicateBaselineKeys` / `SUMMARY.duplicateCurrentKeys` report exact warning counts.
- **Scale Bounds:** Caps input comparison at `maxRows` per side (default `100,000`, max `500,000`) and remote file payloads at `50 MB`.

### Quick Start & Example Input

#### 1. Run in Apify Console (No Code)

1. Open **[`forgekit/dataset-diff-change-detector`](https://apify.com/forgekit/dataset-diff-change-detector)** in Apify Console and click **Try for free**.
2. Paste or adjust the ready-to-run input JSON below (safe defaults are pre-filled).
3. Click **Start** and export results as **JSON, CSV, Excel, or NDJSON** from the **Output** tab.

```json
{
  "baselineRows": [
    {
      "id": "sku-4821",
      "price": 99,
      "inStock": false,
      "scrapedAt": "2026-11-30T10:00:00Z"
    }
  ],
  "currentRows": [
    {
      "id": "sku-4821",
      "price": 79.2,
      "inStock": true,
      "scrapedAt": "2026-12-01T10:00:00Z"
    }
  ],
  "mode": "two-source",
  "maxRows": 100000
}
```

#### 2. Run via API (`apify-client` — Node.js & Python)

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('forgekit/dataset-diff-change-detector').call({"baselineRows":[{"id":"sku-4821","price":99,"inStock":false,"scrapedAt":"2026-11-30T10:00:00Z"}],"currentRows":[{"id":"sku-4821","price":79.2,"inStock":true,"scrapedAt":"2026-12-01T10:00:00Z"}],"mode":"two-source","maxRows":100000});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

```python
from apify_client import ApifyClient
import os

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("forgekit/dataset-diff-change-detector").call(run_input={"baselineRows":[{"id":"sku-4821","price":99,"inStock":False,"scrapedAt":"2026-11-30T10:00:00Z"}],"currentRows":[{"id":"sku-4821","price":79.2,"inStock":True,"scrapedAt":"2026-12-01T10:00:00Z"}],"mode":"two-source","maxRows":100000})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(items)
```

#### 3. Connect to n8n, Make, Zapier & Webhooks

- **n8n / Make / Zapier:** Add the official **Apify** module, choose **Run Actor**, select `forgekit/dataset-diff-change-detector`, and pass the JSON payload above.
- **Schedules & Webhooks:** Attach an Apify Schedule for recurring runs and trigger downstream webhooks automatically on `ACTOR.RUN.SUCCEEDED`.

### Use Cases — What Can You Do With This Data?

- **Automated RevOps & CRM Hygiene:** Chain **Dataset Diff & Change Detector (Added / Removed / Modified)** directly after any Apify scraper via Apify Integrations, Make, or n8n so clean, schema-validated records land straight in HubSpot, Salesforce, Airtable, or Google Sheets.
- **Scheduled Pipeline Automation:** Trigger runs automatically on dataset completion webhooks with deterministic, zero-hallucination TypeScript logic and predictable per-row Pay-Per-Event pricing.
- **AI & RAG Data Preparation:** Clean, deduplicate, diff, or chunk raw web extractions before embedding into Pinecone, Qdrant, Weaviate, or pgvector without burning LLM tokens on boilerplate.
- **Zero-Code Agency Workflows:** Replace brittle local Python scripts and manual Excel cleanup with reproducible, audit-logged cloud runs exported directly to JSON, CSV, NDJSON, or Excel.

### Frequently Asked Questions (FAQ)

#### How much does Dataset Diff & Change Detector (Added / Removed / Modified) cost to run?

You only pay for actual output via transparent Pay-Per-Event billing (starting at `$0.0003` per `row-compared` (Unique record key compared); see the PPE Pricing table above). Runs that produce zero billable results or fail upstream incur **`$0.00`** — including zero `actor-start` fee — and Apify's built-in **Max total charge** (`ACTOR_MAX_TOTAL_CHARGE_USD`) hard-caps spend automatically.

#### Does this Actor require proxies, logins, or CAPTCHA solving?

No. This Actor performs 100% deterministic local data processing on the inputs you provide (Apify Datasets, Key-Value Stores, inline JSON, or public file URLs). It requires zero proxies, zero headless browsers, and never depends on scraping fragile third-party websites.

#### What export formats and integrations are supported?

Every run stores structured results in an Apify Dataset downloadable as **JSON, CSV, Excel (XLSX), NDJSON, XML, or HTML Table** via Console or REST API, plus native connectors for **n8n, Make, Zapier, Google Sheets, Airtable, Slack, and webhooks**.

#### Can AI agents (Claude Desktop, Cursor, ChatGPT, LangChain) call this Actor directly via MCP?

Yes! **Dataset Diff & Change Detector (Added / Removed / Modified)** includes a built-in **Standby MCP Server** at `https://forgekit--dataset-diff-change-detector.apify.actor/mcp` supporting JSON-RPC 2.0 (`initialize`, `ping`, `tools/list`, `tools/call`) with Claude-compliant `^[a-zA-Z0-9_.-]{1,64}$` tool schemas.

#### How does it protect against runaway costs or bad inputs?

Every input is strictly validated upfront with Zod schemas before any work starts, user-supplied URLs pass SSRF protection blocking private/cloud-metadata IPs, and streaming `BudgetGuard` enforcement stops immediately once your result or USD budget cap is reached.

#### How fast and lightweight is it compared to browser scrapers?

It runs on lightweight **Node.js 22** (256–512 MB RAM, zero headless browser) so typical runs finish in seconds with high reliability and low platform compute cost.

### Related `forgekit` Actors

Explore companion Actors in **Data Pipeline & ETL** and core ETL utilities to chain end-to-end pipelines:

| Actor | Store Slug | Mode |
|---|---|---|
| [Dataset Merge, Fuzzy Dedupe & Cross-Join Pro](https://apify.com/forgekit/dataset-merge-dedupe-pro) | `forgekit/dataset-merge-dedupe-pro` | ✅ Standby MCP |
| [Universal Data Converter & Nested JSON Flattener (JSON, CSV, XLSX, XML, NDJSON, SQLite)](https://apify.com/forgekit/universal-data-converter-flattener) | `forgekit/universal-data-converter-flattener` | ✅ Standby MCP |
| [Lead List Cleaner, Schema Validator & Normalizer (B2B CRM Prep)](https://apify.com/forgekit/lead-cleaner-schema-normalizer) | `forgekit/lead-cleaner-schema-normalizer` | ✅ Standby MCP |
| [Bulk Webhook & Rate-Limited HTTP Batch Dispatcher (Retries, Auth & Capture)](https://apify.com/forgekit/bulk-webhook-http-dispatcher) | `forgekit/bulk-webhook-http-dispatcher` | Batch REST API |
| [RSS, Atom & JSON-Feed Aggregator + New-Item Monitor (MCP Ready)](https://apify.com/forgekit/rss-atom-json-feed-monitor) | `forgekit/rss-atom-json-feed-monitor` | ✅ Standby MCP |
| [PDF-to-Markdown, Clean Text & Metadata Extractor (LLM & RAG Ready + MCP)](https://apify.com/forgekit/pdf-to-markdown-text-extractor) | `forgekit/pdf-to-markdown-text-extractor` | ✅ Standby MCP |
| [Bulk Domain Availability, RDAP/WHOIS Expiry & Multi-TLD Matrix Checker (MCP)](https://apify.com/forgekit/bulk-domain-availability-rdap-matrix) | `forgekit/bulk-domain-availability-rdap-matrix` | ✅ Standby MCP |

# Actor input Schema

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

Compare two explicit sources (two-source) or compare current data against a persisted KV baseline snapshot (stateful-snapshot).

## `baselineDatasetId` (type: `string`):

Apify Dataset ID containing baseline (previous) records.

## `currentDatasetId` (type: `string`):

Apify Dataset ID containing current (latest) records.

## `baselineFileUrl` (type: `string`):

Public CSV, JSON, NDJSON, or XLSX URL for the baseline snapshot (SSRF-protected).

## `currentFileUrl` (type: `string`):

Public CSV, JSON, NDJSON, or XLSX URL for the current snapshot (SSRF-protected).

## `baselineRows` (type: `array`):

Inline JSON array of baseline records.

## `currentRows` (type: `array`):

Inline JSON array of current records.

## `snapshotStoreName` (type: `string`):

Named Apify Key-Value Store holding persistent baselines in stateful-snapshot mode.

## `snapshotName` (type: `string`):

Identifier for this monitored dataset inside snapshotStoreName.

## `updateSnapshot` (type: `boolean`):

Persist current rows as the new baseline upon completion (set false for dry-run).

## `emitInitialBaselineAsAdded` (type: `boolean`):

When false (default), the very first stateful baseline run records the snapshot quietly without flooding alerts.

## `keyFields` (type: `array`):

One or more dot-notation field names uniquely identifying each record across snapshots.

## `trackFields` (type: `array`):

If non-empty, only diff these specific fields (empty diffs all fields except ignoreFields).

## `ignoreFields` (type: `array`):

Volatile metadata columns excluded from diff comparison to eliminate false-positive noise.

## `includeStatuses` (type: `array`):

Record categories to push to the output dataset (added, removed, modified, unchanged).

## `numericTolerance` (type: `number`):

Ignore numeric differences where abs(after - before) <= numericTolerance.

## `minPercentChange` (type: `number`):

Only treat numeric field moves whose absolute percentage change is >= minPercentChange as modified.

## `ignoreCaseAndWhitespace` (type: `boolean`):

Normalize string casing and collapse surrounding/inner whitespace before equality checks.

## `ignoreArrayOrder` (type: `boolean`):

Compare arrays as unordered multisets so reordered tags or categories do not trigger false diffs.

## `webhookUrl` (type: `string`):

Optional HTTP/HTTPS webhook endpoint notified with diff summary + top changes (SSRF-protected, stored encrypted as secret).

## `webhookSkipIfNoChanges` (type: `boolean`):

Suppress webhook delivery when totalChanges === 0 to prevent quiet-run alert fatigue.

## `allowEmptyBaselineOverwrite` (type: `boolean`):

Safety guard: when false (default), an empty current snapshot will never wipe an existing baseline or falsely mark every record as removed.

## `maxRows` (type: `integer`):

Hard safety cap on records compared per snapshot and emitted to the dataset.

## Actor input object example

```json
{
  "mode": "two-source",
  "baselineDatasetId": "",
  "currentDatasetId": "",
  "baselineFileUrl": "",
  "currentFileUrl": "",
  "baselineRows": [
    {
      "id": "sku-4821",
      "price": 99,
      "inStock": false,
      "scrapedAt": "2026-11-30T10:00:00Z"
    }
  ],
  "currentRows": [
    {
      "id": "sku-4821",
      "price": 79.2,
      "inStock": true,
      "scrapedAt": "2026-12-01T10:00:00Z"
    }
  ],
  "snapshotStoreName": "dataset-diff-snapshots",
  "snapshotName": "default-baseline",
  "updateSnapshot": true,
  "emitInitialBaselineAsAdded": false,
  "keyFields": [
    "id"
  ],
  "trackFields": [],
  "ignoreFields": [
    "scrapedAt",
    "timestamp",
    "crawledAt",
    "runId"
  ],
  "includeStatuses": [
    "added",
    "removed",
    "modified"
  ],
  "numericTolerance": 0,
  "minPercentChange": 0,
  "ignoreCaseAndWhitespace": false,
  "ignoreArrayOrder": false,
  "webhookSkipIfNoChanges": true,
  "allowEmptyBaselineOverwrite": false,
  "maxRows": 100000
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `diffReportMd` (type: `string`):

No description

## `ppeLedger` (type: `string`):

No description

# 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 = {
    "baselineRows": [
        {
            "id": "sku-4821",
            "price": 99,
            "inStock": false,
            "scrapedAt": "2026-11-30T10:00:00Z"
        }
    ],
    "currentRows": [
        {
            "id": "sku-4821",
            "price": 79.2,
            "inStock": true,
            "scrapedAt": "2026-12-01T10:00:00Z"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("forgekit/dataset-diff-change-detector").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 = {
    "baselineRows": [{
            "id": "sku-4821",
            "price": 99,
            "inStock": False,
            "scrapedAt": "2026-11-30T10:00:00Z",
        }],
    "currentRows": [{
            "id": "sku-4821",
            "price": 79.2,
            "inStock": True,
            "scrapedAt": "2026-12-01T10:00:00Z",
        }],
}

# Run the Actor and wait for it to finish
run = client.actor("forgekit/dataset-diff-change-detector").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 '{
  "baselineRows": [
    {
      "id": "sku-4821",
      "price": 99,
      "inStock": false,
      "scrapedAt": "2026-11-30T10:00:00Z"
    }
  ],
  "currentRows": [
    {
      "id": "sku-4821",
      "price": 79.2,
      "inStock": true,
      "scrapedAt": "2026-12-01T10:00:00Z"
    }
  ]
}' |
apify call forgekit/dataset-diff-change-detector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,forgekit/dataset-diff-change-detector"
        }
    }
}
```

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/BtzgZpCUD7qK54me0/builds/bL3dZ7aA5Y2FUNa90/openapi.json
