Dataset Merge & Dedup avatar

Dataset Merge & Dedup

Pricing

from $0.30 / 1,000 output items

Go to Apify Store
Dataset Merge & Dedup

Dataset Merge & Dedup

Merge one or more Apify datasets, remove duplicates by any field (nested paths too), keep only items never seen in earlier runs, and output one clean dataset.

Pricing

from $0.30 / 1,000 output items

Rating

0.0

(0)

Developer

Black Vikings

Black Vikings

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 hours ago

Last modified

Categories

Features

Limited permissions

Share

Merge one or more Apify datasets into one clean dataset: duplicates removed, optional filters and field cleanup, and an "only new items" mode that outputs only what earlier runs have not already delivered.

Built for the step after a scraper: run it from a webhook or integration when your scraper finishes, and send only fresh, unique rows to your sheet, CRM, or database.

Why use it

  • Handles large datasets. Items are streamed page by page, so a 1M-item dataset never sits in memory. Only a 16-character hash per unique key is kept.
  • Works with limited permissions. Pick datasets in the input and Apify grants read access automatically.
  • Clear errors. A missing dataset, a dataset the run may not read, or empty input stops the run with a message naming the dataset and how to fix it. You are never charged for a silent empty run.
  • Only new items. Remembers what earlier runs output, so daily runs deliver just the new rows.
  • Safe filters. Simple declarative conditions. No custom JavaScript is executed.

Typical use: after a scraper run

  1. In your scraper's Integrations tab, add Run another Actor (or a webhook on ACTOR.RUN.SUCCEEDED) that starts this Actor.
  2. Pass the finished run's dataset: {"datasetIds": ["{{resource.defaultDatasetId}}"], "dedupFields": ["url"], "onlyNewSinceLastRun": true, "stateKey": "my-scraper"}.
  3. Connect this Actor's output to Google Sheets, Make, Zapier, or your API.

Input

FieldWhat it does
datasetIdsDatasets to merge, in order.
actorOrTaskId, lastRunsAlso merge the default datasets of the last N successful runs (needs full permissions).
dedupFieldsFields that identify an item, nested paths allowed (address.city). Empty = compare whole items.
dedupModekeepFirst (default) or keepLast. keepLast reads the data twice.
onlyNewSinceLastRun, stateKeySkip items whose key an earlier run with the same stateKey already output.
fields, omitFields, renameFieldsKeep, drop, or rename fields in the output.
filter{"match": "all", "conditions": [{"field": "status", "operator": "equals", "value": "open"}]}. Operators: equals, notEquals, contains, exists, notExists.
outputDatasetNameWrite to a named dataset instead of the run's default dataset.

Order of operations: merge, then filter, then dedup (on the original fields), then only-new, then pick/omit/rename.

Field paths use dots for nested fields (address.city). Array indexes (tags.0) are allowed in dedupFields and filter only; fields, omitFields, and renameFields reject them, so name the whole field instead.

Items that have none of the dedupFields are kept as they are (never merged into one), counted as missingKeyItems, and reported in the log. If no item has any of the fields, the run fails before charging anything: that is almost always a typo.

Example

Input:

{
"datasetIds": ["aBcD1234", "eFgH5678"],
"dedupFields": ["url"],
"onlyNewSinceLastRun": true,
"stateKey": "shops-mx",
"omitFields": ["debug"],
"renameFields": { "title": "name" }
}

Besides the items, every run stores a summary in the OUTPUT record of its key-value store:

{
"itemsRead": 12000, "filteredOut": 0, "duplicatesRemoved": 3100, "missingKeyItems": 0, "previouslySeen": 8500, "outputItems": 400,
"datasets": [{ "datasetId": "aBcD1234", "itemsRead": 7000 }, { "datasetId": "eFgH5678", "itemsRead": 5000 }],
"chargeLimitReached": false, "dedupMode": "keepFirst", "onlyNewSinceLastRun": true,
"durationMs": 9100
}

When does a run fail instead of succeeding with 0 items?

  • Fails: a dataset is missing or not readable, all input datasets are empty, the filter matched 0 items, no item has the dedup fields, or the maximum charge allows 0 items.
  • Succeeds with 0 items: everything was already output by earlier runs ("only new items" mode). The log and summary say so.

Failed runs are never charged.

Pricing

Pay per event: you pay per item written to the output (event output-item): $0.50 per 1,000 items on the Free and Starter plans, $0.40 on Scale and $0.30 on Business. Duplicates and filtered items are free. A flat $0.001 per run (event run-start) is charged only once the run is sure to succeed, never for a run that fails on input or access. The run respects your maximum charge per run: it stops cleanly at the limit, saves what it wrote, and reports chargeLimitReached: true.

Limits

  • Default memory is 1 GB. Measured peak: about 150 MB for 10k items, 270 MB for 100k, and 620 MB for 1M items with "only new items" (the worst case). Datasets beyond a few million items need more memory.
  • Memory: roughly 60 bytes per unique key (measured ~53 B per key in a hash set). With "only new items" or keepLast, budget about twice that. 1 GB comfortably handles ~5M unique keys; raise the run memory for more.
  • State for "only new items" is stored in the named key-value store dataset-dedup-state, in parts of 200,000 hashes per record.
  • Hashes are 96-bit; an accidental collision is negligible even at hundreds of millions of keys.
  • keepLast reads each dataset twice; do not run it on a dataset that is still being written.
  • Restarts and migrations: progress is checkpointed in the run's key-value store (DEDUP_CHECKPOINT) after every written batch. A restarted run replays what it already delivered without pushing or charging it again. Only a crash in the instant between a push and its checkpoint can repeat that one batch (at most 1,000 items).
  • Run one job per stateKey at a time. Concurrent runs merge their state when saving, but they do not see each other's items while running, so both may output the same new item.
  • With limited permissions, the Actor cannot browse run history (actorOrTaskId). Pass dataset IDs instead. A named output dataset must be one this Actor created.

FAQ

My run failed with "not allowed to read it". Select the dataset with the picker in the Datasets field, or check that it belongs to the account running the Actor.

Can I reset "only new items"? Use a new stateKey. Items output under the old key will be output once more.

Does it change my source datasets? No. Sources are only read.