Deduplicate & Merge Apify Datasets: remove duplicate items avatar

Deduplicate & Merge Apify Datasets: remove duplicate items

Pricing

from $0.15 / 1,000 unique items

Go to Apify Store
Deduplicate & Merge Apify Datasets: remove duplicate items

Deduplicate & Merge Apify Datasets: remove duplicate items

Deduplicate and merge one or more Apify datasets (or a pasted JSON array): removes duplicate items by any fields (dot paths allowed) or by the whole item, keeping the first or last occurrence. Streams millions of items with constant memory. Use to clean repeated scraper runs before export.

Pricing

from $0.15 / 1,000 unique items

Rating

0.0

(0)

Developer

Bosco Labs

Bosco Labs

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

11 days ago

Last modified

Features

Limited permissions

Share

Deduplicate and merge one or more Apify datasets into one, removing duplicate items by any fields you choose (for example url, email or address.city), or by the whole item. Built for people who run the same scraper many times, or several scrapers, and need one clean list. It streams the data, so millions of items run with constant memory.

Pricing (pay per event): $0.00015 per unique item written ($0.15 per 1,000). Duplicates are free, reading is free, there is no start fee, and the run stops at your max charge limit.

Input

{
"datasetIds": ["aBcD1234efGH5678i", "jKlM9012noPQ3456r"],
"fields": ["url"],
"keep": "first",
"outputFields": ["url", "title", "price"]
}
FieldMeaning
datasetIdsDatasets to merge, in this order
itemsOr paste a JSON array of items directly (processed first)
fieldsTwo items are duplicates when all these fields are equal. Dot paths work: address.city, emails.0. Empty = compare whole items
keepfirst (default) keeps the first occurrence; last keeps the last one
outputFieldsKeep only these top-level fields in the output. Empty = all fields

Output

The unique items, unchanged, in input order (dataset 1 first, then dataset 2, ...). With the input above and these two datasets:

[{"url": "https://a.com/1", "title": "A", "price": 10},
{"url": "https://a.com/2", "title": "B", "price": 12}]
[{"url": "https://a.com/1", "title": "A", "price": 9},
{"url": "https://a.com/3", "title": "C", "price": 7}]

the output dataset is:

[{"url": "https://a.com/1", "title": "A", "price": 10},
{"url": "https://a.com/2", "title": "B", "price": 12},
{"url": "https://a.com/3", "title": "C", "price": 7}]

With "keep": "last" the first row would be the one with "price": 9, at the position of its last occurrence. The log ends with the counts: read=4 duplicates=1 written=3.

Use cases

  • Daily scrapes without repeats: merge today's run with earlier runs and keep only new URLs, products or listings.
  • Lead lists: combine several scrapers (Maps, websites, directories) and dedupe on email or phone.
  • Latest price per product: dedupe on sku with keep: last.
  • Before exporting: clean a dataset before it goes to Sheets, a CRM or a warehouse.

Use with AI agents (MCP)

Agents can call this Actor as a tool through the Apify MCP server. Add this server URL to your MCP client (Claude, Cursor, VS Code, ...):

https://mcp.apify.com?tools=bosco_labs/dataset-dedup

It loads this Actor as a tool, plus the tools that read its results (get-actor-run, get-dataset-items). The hosted server signs you in with OAuth, or accepts your Apify token as Authorization: Bearer <APIFY_TOKEN>. On the default server (https://mcp.apify.com), agents can also find this Actor with search-actors and run it with call-actor.

Example prompts this Actor answers:

  • "Merge the results of my last three Google Maps runs and remove duplicate places by placeId."
  • "Deduplicate this list of leads by email and keep only name, email and website."
  • "Keep only the latest price per SKU from these two product datasets."

For the first one, the agent passes:

{"datasetIds": ["<dataset ID 1>", "<dataset ID 2>", "<dataset ID 3>"], "fields": ["placeId"]}

Output for agents: the unique items, unchanged and in input order, in the run's default dataset. The Actor adds no fields of its own (no schema_version or source link), since the items are your data; the run log ends with read, duplicates and written counts.

Cost: $0.00015 per unique item written (duplicates are free), billed to the Apify account the MCP server is signed in with.

FAQ

How big can the datasets be? For every distinct key the Actor keeps a 16-byte hash in memory, never the items. 10 million distinct keys need roughly 1-2 GB, so most runs fit in the default memory.

Is keep: last slower? It reads the input datasets twice (once to find the last occurrence of each key, once to write), still without holding the items in memory.

What about items that don't have the dedupe field? They are always kept, never merged with each other, and counted as kept_without_key in the log. A field that is null counts as missing.

Are 1 and "1" the same? No. Values are compared exactly as stored (type included). Whole-item comparison ignores the order of keys.

Which datasets can it read? Only the ones you pick in the input. The Actor runs with limited permissions, so it can't see any other storage in your account.

What if the run is restarted by the platform? It starts over, skips the items it already wrote, and doesn't charge them again.