# Dataset Diff Feed: Only New, Changed & Removed Items (`siteverdict/siteverdict-dataset-diff-feed`) Actor

Compares each run of your Apify dataset with the previous one, by the key fields you choose, and outputs only added, removed and changed items with field-level before/after values. Read-only access to the dataset you pick. Free demo mode.

- **URL**: https://apify.com/siteverdict/siteverdict-dataset-diff-feed.md
- **Developed by:** [Aman Thakran](https://apify.com/siteverdict) (community)
- **Categories:** Developer tools, Automation, Integrations
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Dataset Diff Feed: Only New, Changed & Removed Items

Compares each run of your Apify dataset with the previous one, using the key fields you choose. It outputs only the items that were **added**, **removed** or **changed**, with field-level before and after values. It reads only the dataset you pick, and has a free demo mode.

### What it does

Most scrapers return the whole list every time: all 20,000 products, all 3,000 job ads, every lead. This Actor turns that into a **change feed**:

- **ADDED**: a key (for example a product URL) that was not in the previous run.
- **REMOVED**: a key that was in the previous run but is missing now.
- **CHANGED**: the same key with different values in the fields you care about. Each row lists `{field, before, after}`.
- **One summary row** on every run, so you can always see what happened: items read, added, removed, changed, unchanged, duplicates, rows without a key, and any warnings.

How it avoids false alarms:

- **Formatting-only differences are not changes.** In Standard mode, all of these count as "the same":

  - extra spaces;
  - different Unicode forms;
  - object key order;
  - `10` vs `"10.0"`.

  They are counted in `formattingOnly` (also when a run timestamp changes on the same items) but never reported or charged. Use **Strict** to report every byte difference, or **Loose** to also ignore upper and lower case.
- **Fields you ignore never count.** For example `scrapedAt`, `timestamp` and `updatedAt`.
- **Numeric tolerance**, for example `0.01`, so tiny float jitter in prices is not a change.
- **Output format changes.** If your scraper starts or stops sending a field, every item would look "changed". By default, that field is skipped for that run and a warning is shown. You can choose instead to report those changes or to stop the run.
- **Run timestamps are recognised.** If a field such as `retrievedAt` or `runId` has one value per run and therefore changes on every item, it is not compared and a warning names it. A genuine change on every item (for example currency GBP to EUR) is still reported.
- **Empty dataset guard.** If the dataset is empty, which usually means the scrape failed, nothing is reported as removed. The baseline is kept, and nothing is charged.
- **Settings changed.** If you change the key fields, the compared fields or the formatting mode, the Actor stores a new baseline instead of reporting everything as changed.

**Restart-safe and no duplicate alerts:**

- The new baseline and this run's changes are saved together in one step before anything is sent.
- If a run dies after that step, the next run delivers the pending changes first. They are marked `redelivered: true` and are not charged again.
- If your maximum charge per run is reached, the rows already written stay written and are never sent or charged again. The rest are held back (not charged) and the next run handles them first:
  - it delivers the held-back rows, each charged once (`change-emitted`) because they were never charged before;
  - then, in the same run, it compares your dataset as usual, charging the normal comparison fee (`diff-run`) once and `change-emitted` only for new changes;
  - the comparison fee is set aside before the held-back rows are charged, so the run still stays within its maximum. If that maximum is reached again while delivering held-back rows, the run stops there: no new comparison, no comparison fee, and the baseline does not move, so nothing is lost. The following run continues.
- Every change has a deterministic `changeId`, so downstream tools can de-duplicate safely.

### Who it is for

- **Teams running scheduled scrapers** who only want what is new or different: price monitors, job boards, real-estate listings, lead lists, catalogue trackers.
- **Anyone loading Apify results into a CRM, a spreadsheet or Slack** who is tired of re-importing the same rows.
- **Developers** who want a reliable "only changes" step to chain after any Actor, without writing diff code.

### Quick start

1. Click **Start** with the default (empty) input. The free demo compares two built-in synthetic snapshots of 50 made-up products and shows:
   - 3 added, 2 removed and 4 changed items;
   - 2 formatting-only differences that are correctly *not* reported.
2. For real use, pick your scraper's dataset in **Dataset to watch** and set **Key fields** (for example `url`).
3. The first real run stores a baseline (no change rows). From the second run on you get only the changes.

**Chain it after your scraper** (recommended):

1. Open your scraper Actor, go to **Integrations**, and choose **Connect Actor or task**.
2. Pick this Actor (or a saved task of it) and the event **Run succeeded**.
3. In the input, set `"datasetId": "{{resource.defaultDatasetId}}"`, plus your key fields and a fixed **Monitor name**.

Every successful scrape now produces a change feed.

### Input

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `datasetId` | dataset picker | no | The dataset to compare. Empty = free demo. The Actor gets **read-only access to this dataset only**. |
| `keyFields` | array | when a dataset is set | Field(s) that identify an item across runs, e.g. `url`, `sku`, or nested `offer.id`. |
| `compareFields` | array | no | Only these fields decide whether an item changed. Empty = every top-level field except ignored ones. |
| `ignoreFields` | array | no | Fields that never count as a change. Default: `scrapedAt`, `crawledAt`, `timestamp`, `loadedAt`, `updatedAt`. |
| `formatting` | string | no | `standard` (default), `strict` or `loose`, as described above. |
| `numericTolerance` | number | no | Numbers closer than this are equal. Default 0. |
| `emit` | array | no | Which change types to output: `added`, `removed`, `changed`. Default all. |
| `includeFullRecord` | boolean | no | Add the full current item (or the stored previous values for removed items) to each change row. |
| `schemaChangePolicy` | string | no | `skip-fields` (default), `report` or `fail`: what to do when a field appears or disappears. |
| `monitorId` | string | no | Names the private state store in **your** account: `sv-diff-<name>`. Use one name per dataset you watch. Lower-case letters, digits and dashes, up to 40 characters. |
| `maxItems` | integer | no | Safety limit (default 200,000; max 500,000). Larger datasets stop the run without charging or changing the baseline. |
| `maxChangeRows` | integer | no | Cap on change rows per run (default 100,000). Extra changes are counted, not written or charged. |
| `webhookUrl` | string (secret) | no | Public https URL (Slack-compatible) that receives a short summary when there are changes. Private or internal addresses are refused. Never logged or saved. |

Example input:

```json
{
  "datasetId": "YOUR_DATASET_ID",
  "keyFields": ["url"],
  "ignoreFields": ["scrapedAt"],
  "numericTolerance": 0.01,
  "monitorId": "shop-prices"
}
```

### Output

**Output contract:** one dataset row per change, plus **exactly one** `summary` row per run. The number of rows depends on how many items changed, not on the number of inputs (for example, the demo gives 9 change rows + 1 summary). `RESULTS.csv` (one row per changed field) and `OUTPUT` (run summary) are saved in the run's key-value store.

| Field | Type | Description |
| --- | --- | --- |
| `rowType` | string | `change` or `summary` |
| `changeType` | string | `ADDED`, `REMOVED` or `CHANGED` |
| `key` | object | Key field values, e.g. `{"url": "…"}` |
| `changedFields` | array | `[{field, before, after}]` for CHANGED rows |
| `changeId` | string | Deterministic ID of this change (safe to de-duplicate on) |
| `keyHash` | string | Stable hash of the key |
| `record` | object | Full item (only with `includeFullRecord`) |
| `redelivered` | boolean | `true` when re-sent from an earlier unfinished run |
| `itemsRead`, `added`, `removed`, `changed`, `unchanged`, `formattingOnly` | integer | Summary counts |
| `duplicateKeys`, `duplicateKeysConflicting`, `rowsMissingKey`, `changesNotWritten` | integer | Data-quality counts |
| `schemaChanges` | object | Fields added or removed in your scraper's output |
| `baselineCreated`, `demoMode` | boolean | Run status |
| `monitorId`, `sourceDatasetId`, `previousSnapshotAt`, `comparedAt` | string | Where and when |
| `chargedEvents` | object | Events charged so far in this run |
| `warnings` | array | Plain-English warnings |

Sample change row (from the demo):

```json
{
  "rowType": "change",
  "changeType": "CHANGED",
  "key": { "sku": "DEMO-001" },
  "changedFields": [{ "field": "price", "before": 42.99, "after": 9.99 }],
  "changeId": "…",
  "demoMode": true
}
```

### Pricing (pay per event)

| Event | Title | Price (USD) | Charged when |
| --- | --- | --- | --- |
| `diff-run` | Comparison (per 10,000 items checked) | $0.005 | Once per started block of 10,000 items read from your dataset (2,500 items = 1, 25,000 items = 3). The first run, which stores the baseline, counts the same way. |
| `change-emitted` | Change emitted | $0.0003 | One added, removed or changed item written to the dataset. |

**Never charged:**

- unchanged items and formatting-only differences;
- the demo;
- runs that stop with an error, an empty dataset or a dataset over your item limit;
- rows re-sent after a crashed run (marked `redelivered: true`);
- changes over your row cap.

**Maximum charge per run.** The Actor plans every charge so it never goes over the maximum you set. If the maximum is too low for the comparison fee, it does nothing and says so. If the maximum is reached while change rows are being written, the rest are held back uncharged; the next run delivers them first (charged once) and then compares as usual (see *Restart-safe* above).

**Worked examples:**

- 20,000 products checked daily, 5% changing: 2 × $0.005 + 1,000 × $0.0003 = **$0.31 per run**, about **$9.30 per month**.
- 500 job ads checked daily, 10 changes: $0.005 + 10 × $0.0003 = **$0.008 per run**, about **$0.24 per month**.
- 200,000 items checked weekly, 100 changes: 20 × $0.005 + 100 × $0.0003 = **$0.13 per run**.

### Limits

- Up to 500,000 items per dataset (`maxItems`, default 200,000). Memory grows with the number of items and fields. In local tests with 12-field items, the peak was about 0.4 GB at 50,000 items, 1.0 GB at 200,000 and 1.9 GB at 500,000. Use the default 1 GB up to about 100,000 items, 2 GB up to 200,000, and 4 GB above that.
- **One baseline per monitor name:** this run is compared with the previous run only. There is no long-term history in v1.
- Key fields must exist on the items. Items without a key are counted and skipped. If the key repeats, the first item is used.
- Field paths use dots (`offer.price`). Field names that themselves contain dots cannot be addressed. The names `__proto__`, `constructor` and `prototype` are refused for safety.
- Very long values (over 300 characters) are compared by hash, and shown truncated in before/after.
- The first run for a monitor name only stores the baseline. Changing key fields, compared fields or formatting also starts a new baseline.
- Arrays are compared in order: `[a, b]` is different from `[b, a]`.

### Sources & compliance

- **Your data stays in your account.**
  - The Actor reads only the dataset you choose, and only with read access.
  - It runs with Apify's **limited permissions**, so it cannot see your other datasets or storages.
  - The baseline lives in a named key-value store in **your own** account (`sv-diff-<monitor name>`). It holds only the key values and compared field values. Delete that store at any time to reset.
- **We keep no copy.** No data is sent anywhere except to the optional webhook you configure, which receives counts only, not your items.
- **You are the data controller.** If your dataset contains personal data, you decide what to watch and for how long. The Actor only processes it on your instruction, inside your Apify account.
- **No secrets in output.** The webhook URL is treated as a secret: it is removed from logs, results and the run summary.

Not legal, security or financial advice.

### FAQ

**Why are there no change rows on the first run?**
The first run only stores the baseline (`baselineCreated: true`). Changes appear from the second run with the same monitor name.

**Why 0 changes when I know the data changed?**

- Check that the changed field is not in **Fields to ignore**, and that **Fields to compare** includes it if you set it.
- Formatting-only differences are deliberately not reported. Use `strict` if you need them.

**Why did my whole dataset show as ADDED?**

- The key field values changed format, for example `http://` became `https://`, or a tracking parameter appeared in the URL.
- Or you used a different monitor name.

Pick a key that stays stable.

**What happens if my scraper fails and returns nothing?**
The run stops with "dataset is empty". Nothing is reported as removed, nothing is charged, and the baseline is kept.

**What if the run timeout is very short?**
If fewer than 45 seconds are left, the Actor does nothing, writes one summary row explaining why, and charges nothing. It also stops cleanly (without changing the baseline) if time runs out while reading a large dataset.

**I mistyped an input field. Will I know?**
Yes. Unknown input fields are listed in the summary row warnings.

**Can I watch several datasets?**
Yes. Use a different **Monitor name** for each, for example `shop-uk` and `shop-de`.

**Is the webhook URL stored?**
No. It is a secret input, removed from logs and results. Only public http(s) addresses are accepted.

### Integrations

- **Apify integrations:** "Run succeeded" on your scraper starts this Actor with `{{resource.defaultDatasetId}}`.
- **Slack:** paste an incoming-webhook URL into `webhookUrl`.
- **Make, n8n, Zapier:** read this run's dataset, or use its webhook.
- **API:** `GET /v2/datasets/{defaultDatasetId}/items?view=results`.

### Changelog

- 0.2 (release candidate, 13 Nov 2026): the maximum charge per run is never exceeded; rows held back by the maximum are delivered (and charged) once, first thing in the next run, which then compares as usual; change rows are written in batches (much faster for large diffs); comparison priced per 10,000 items; fields named like `vat` or `format` are no longer mistaken for run timestamps; the `formattingOnly` count is now correct when a run timestamp also changed; `before` values are no longer shown as empty for some items whose stored baseline kept a formatted value.
- 0.1.0 (15 Oct 2026): first version. Keyed diff, formatting-safe comparison, schema-change handling, restart-safe delivery, demo mode. Built on the shared `@siteverdict/diff` engine.

# Changelog

This Actor's version history is a separate document: https://apify.com/siteverdict/siteverdict-dataset-diff-feed/changelog.md

# Actor input Schema

## `datasetId` (type: `string`):

The dataset to compare with its previous snapshot (for example the default dataset of your scraper's last run). Leave empty to run the free demo on two built-in synthetic snapshots.

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

Field(s) that identify an item across runs, e.g. url or sku. Use dots for nested fields (offer.id). Required when a dataset is chosen. The demo uses sku.

## `compareFields` (type: `array`):

Only these fields decide whether an item changed. Leave empty to compare every top-level field except the ignored ones.

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

Fields that change on every run and should never count as a change.

## `formatting` (type: `string`):

How formatting-only differences are treated. Standard (recommended) never reports whitespace, key-order or 10 vs "10.0" differences as changes.

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

Numbers closer than this are treated as equal (e.g. 0.01 for prices). 0 means exact.

## `emit` (type: `array`):

Which change types are written to the dataset (and charged).

## `includeFullRecord` (type: `boolean`):

Add the complete current item (or the stored previous values for removed items) to each change row.

## `schemaChangePolicy` (type: `string`):

What to do when a field exists in only one of the two snapshots (your scraper's output format changed).

## `monitorId` (type: `string`):

Names the private state store in your account (sv-diff-<name>). Use a different name for each dataset you watch.

## `maxItems` (type: `integer`):

Safety limit on items read from the dataset. If the dataset is larger the run stops without charging or changing the baseline.

## `maxChangeRows` (type: `integer`):

Cap on change rows written in one run. Extra changes are counted in the summary, not written or charged.

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

Public https URL (Slack-compatible) that receives a short summary when changes are found. Private and internal addresses are refused. Never logged or saved.

## Actor input object example

```json
{
  "keyFields": [],
  "ignoreFields": [
    "scrapedAt",
    "crawledAt",
    "timestamp",
    "loadedAt",
    "updatedAt"
  ],
  "formatting": "standard",
  "numericTolerance": 0,
  "emit": [
    "added",
    "removed",
    "changed"
  ],
  "includeFullRecord": false,
  "schemaChangePolicy": "skip-fields",
  "monitorId": "default",
  "maxItems": 200000,
  "maxChangeRows": 100000
}
```

# Actor output Schema

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

No description

## `output` (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 = {
    "keyFields": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("siteverdict/siteverdict-dataset-diff-feed").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 = { "keyFields": [] }

# Run the Actor and wait for it to finish
run = client.actor("siteverdict/siteverdict-dataset-diff-feed").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 '{
  "keyFields": []
}' |
apify call siteverdict/siteverdict-dataset-diff-feed --silent --output-dataset

```

## MCP server setup

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

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/mPgL1WyRpogshQ0Jo/builds/XQpdPoOPdZoTEwtBR/openapi.json
