Merge & Deduplicate Datasets – Filter, Pick, Rename
Pricing
from $0.21 / 1,000 written rows
Merge & Deduplicate Datasets – Filter, Pick, Rename
Merge and deduplicate Apify datasets with limited permissions: remove duplicates by key fields (trim, case and URL normalization), keep first or last, filter, pick and rename fields, append only new rows to a named dataset. $0.30 per 1,000 rows written; only written rows are charged.
Pricing
from $0.21 / 1,000 written rows
Rating
0.0
(0)
Developer
Klarto
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
13 hours ago
Last modified
Categories
Features
Share
Merge and deduplicate Apify datasets in one run: pick your datasets, choose the fields that make a row unique, and get one clean dataset without duplicates. $0.30 per 1,000 rows written. Only written rows are charged: removed duplicates and filtered rows are free, and demo and count-only runs pay only the Apify start event ($0.00005 per GB of memory).
Why use it
- Works out of the box with limited permissions. You pick the datasets in the form, and the run can read exactly those datasets and nothing else. There is no full account access to approve.
- Near-duplicates without code. Tick the normalization options to ignore extra spaces, letter case, and for URLs
www.,httpvshttps, trailing slashes andutm_*tracking parameters. No JavaScript to write. - Cheap preview. 'Count only' writes no rows and charges no rows (only the start event) and tells you how many duplicates (and, with 'Only new rows', how many rows are already in your master dataset) there are.
- Only new rows into a master dataset. Append each new scraper run to one named dataset; rows that are already there are skipped and not charged.
- Clear reporting. Every run ends with the counts (or the error) in its status message and the
OUTPUTrecord, warns when no row has your key field (and lists the fields it found), and says when the maximum charge, 'Max rows to write', the timeout or memory stopped it. - Safe on big jobs. Rows stream page by page, and a run restarted by the platform (migration) continues without writing or charging a row twice.
What it does
- Input: 1–200 Apify datasets (IDs or names), read in the order you list them.
- Remove duplicates by one or more key fields (
url, oremail+company, nestedaddress.city, list itemsemails.0), or by the whole row.- Keep the first or the last row of each key.
- Rows whose key fields are all empty are kept by default (or removed, or treated as one value).
- Write the unique rows, only the removed duplicates, or nothing (count only: no rows charged).
- Transform rows: keep only some fields, remove fields, rename fields, add the source dataset to each row.
- Filter rows: exists, is missing, equals, does not equal, contains, does not contain, greater than, less than.
- Output: the run's default dataset, or appended to a named dataset (created if it does not exist). A summary with all counts is in the
OUTPUTrecord and in the run's status message.
How it works
- Check. Every dataset is looked up first. A wrong ID or a dataset without access stops the run before anything is written or charged.
- Read. Rows are read through the Apify API page by page (page size adapts to row size; the next page loads while the current one is processed). Values are kept as stored: dates are not parsed or reformatted, and big integers and Unicode text stay intact.
- Filter, then compare. The key of each row is the values of the key fields (normalized if you chose so), hashed to 16 bytes (BLAKE2b), so memory stays small: about 100–130 bytes per unique key measured for 'Keep first'.
- Transform the rows you keep: pick, remove, rename.
- Write in batches of up to 2,000 rows, then charge for the rows written. Your data is not sent to any service outside Apify.
Input
| Field | Default | What it does |
|---|---|---|
datasets | empty = demo (rows not charged) | Datasets to merge, in order. In the form, pick them; through the API, pass IDs or names (my-leads, username~my-leads). A name of exactly 17 letters and digits looks like an ID: write it as ~name. |
removeDuplicates | true | Turn off to only merge, filter and reshape. |
dedupFields | empty = whole row (the form pre-fills url) | Key fields. Dots for nested fields, numbers for list items. |
normalize | [] = exact (the form pre-fills trim, url) | trim (spaces), lowercase (letter case), url (values with a scheme like https://, starting with www., or a domain with a path like example.com/about; plain text such as St.Louis is not changed). Used only to compare; rows are written unchanged. In every mode 1 and 1.0 count as the same number. |
keep | first | first or last row of each key. last reads the data twice. |
emptyDedupFields | keep | Rows whose dedup fields are all empty: keep, drop or dedupe (keep one). The old name emptyKeys still works. |
output | unique | unique, duplicates (only rows removed as duplicates inside the input; they are written and charged like any row; rows found in skip datasets are not written; not together with 'Only new rows') or countOnly (writes nothing; no rows charged, only the start event). |
outputDataset | empty = default dataset | Append to this dataset; a new name is created. An unknown 17-character ID is an error, not a new name (use ~name). |
skipExistingInOutput | false | Only new rows: skip rows whose key is already in outputDataset. |
excludeDatasets | empty | Skip rows whose key is in any of these datasets. |
fields | all | Keep only these fields, in this order; missing ones become null, so every row has the same columns. A path with a number in it (emails.0, stats.2024) is always one column with that literal name. Other dotted paths stay nested (address.city → {"address": {"city": …}}). |
omitFields | none | Remove these fields; emails.0 removes the first item of the list. |
renameFields | none | Old name → new name ({"key": "url", "value": "website"}); a dot in the new name nests the value; renaming emails.0 moves the first item out of the list. An existing field with the new name is replaced. If a part of the new path is a list or text, the value gets the literal dotted name instead. |
filters | none | [{"field": "rating", "operator": "greaterThan", "value": "4"}]; a row must match all. |
addSourceDatasetId | false | Adds sourceDatasetId (dataset name or ID) to each row. |
maxOutputRows | 0 = no limit | Stop after this many rows. |
Order of steps: filters (on the original row) → duplicate check → keep only → remove → rename. Key fields are read from the original row; without key fields, whole rows are compared as they will be written (after keep only, remove and rename). With 'Only new rows', key fields are matched in the output dataset under their renamed names, and a row whose key fields are all empty is skipped when the same whole row is already there.
{"datasets": ["YOUR_DATASET_ID_1", "YOUR_DATASET_ID_2"],"dedupFields": ["url"],"normalize": ["trim", "url"]}
Output
Rows are your own rows, unchanged unless you asked to transform them. This row and summary come from the demo run of build 0.1.10 on the platform (the Café Zürich row was kept; its copy https://cafe-zuerich.example in the second sample dataset was removed as a near-duplicate):
{"name": "Café Zürich","url": "https://www.cafe-zuerich.example/","email": "hello@cafe-zuerich.example","city": "Zürich","rating": 4.6,"scrapedAt": "2026-11-01T09:00:00.000Z"}
Summary (the full OUTPUT record of the same run):
{"complete": true,"stopped": null,"error": null,"demo": true,"rowsRead": 15,"rowsFilteredOut": 0,"duplicatesRemoved": 6,"alreadyInOutputOrExcluded": 0,"rowsWithEmptyKey": 2,"rowsWithEmptyKeyDropped": 0,"rowsWritten": 9,"rowsTooLargeSkipped": 0,"rowsCharged": 0,"outputDatasetId": "2g1tRLlNkqT19dDxR","outputDatasetName": null,"outputUrl": "https://console.apify.com/storage/datasets/2g1tRLlNkqT19dDxR","sources": [{"input": "demo-run-1", "datasetId": "demo-run-1", "name": "demo-run-1", "rowsRead": 8},{"input": "demo-run-2", "datasetId": "demo-run-2", "name": "demo-run-2", "rowsRead": 7}],"settings": {"keyFields": ["url"], "normalize": ["trim", "url"], "keep": "first", "removeDuplicates": true, "output": "unique"},"warnings": [],"durationSec": 0.4}
| Field | Type | Meaning |
|---|---|---|
complete | boolean | false when the run stopped early (see stopped) or failed. |
error | string or null | Why the run failed (bad input, a dataset that cannot be read, memory, a write error); null on success. |
stopped | string or null | charge limit, max rows, timeout, memory, aborting. |
rowsRead | number | Rows read from all datasets. |
rowsFilteredOut | number | Rows that did not pass the filters. |
duplicatesRemoved | number | Rows removed as duplicates of an earlier (or, with 'Keep last', a later) row. |
alreadyInOutputOrExcluded | number | Rows skipped because their key is in the output dataset ('Only new rows') or in a skip dataset. |
rowsWithEmptyKey / rowsWithEmptyKeyDropped | number | Rows whose key fields were all empty / of them removed. |
rowsWritten / rowsCharged | number | Rows written to the output dataset / of them charged (0 in the demo and without pricing). |
rowsTooLargeSkipped | number | Rows over 9 MB, which Apify datasets cannot store (not charged). |
demo | boolean | true when no dataset was given and the built-in sample was used (rows not charged). |
outputDatasetId, outputDatasetName, outputUrl | string | Where the rows are (outputDatasetName is null for unnamed datasets). |
sources | list | Each dataset with its ID, name and rows read. |
warnings | list | For example key fields that no row has, with the fields that were found. |
settings | object | Key fields, normalization, keep, remove duplicates and output mode used. |
durationSec | number | Run time of the merge in seconds. |
Datasets follow Apify data retention; unnamed datasets are removed after your plan's retention period, named ones are kept.
Pricing
| Event | Price | When |
|---|---|---|
row-written | $0.0003 | Each row written to the output dataset |
apify-actor-start | $0.00005 per GB of memory | Each run ($0.00005 at the default 1 GB; a run you start with more memory pays more) |
Paid Apify plans pay less. Apify Store discounts apply automatically: Bronze 10% off, Silver 20% off, Gold and higher 30% off. The prices above are Free-plan prices; the Store card shows the lowest (Gold) price. The start event (apify-actor-start) has no discount.
- Not charged: removed duplicates, filtered rows, removed rows with empty keys, rows over 9 MB, and the rows of count-only and demo runs; those runs pay only the start event. With 'What to write' = only the removed duplicates, the duplicates are the rows written, so each of them is charged. A run that stops on a wrong ID or missing access writes nothing, so only the start event is charged.
- Examples: 1,000 rows written = $0.30 + $0.00005. 100,000 rows written = $30.00 + $0.00005. Merging 12,000 rows into 10,000 unique rows = $3.00.
- Charge limit: set the maximum cost of a run; the run never writes more rows than that amount pays for, stops cleanly and says so in its status and in
OUTPUT(stopped: "charge limit"). A platform restart never charges a row twice. If the charge API keeps failing (also on the last batch), the rows already written stay free and the summary's warnings say how many.
Limits
- Datasets: up to 200 per run; up to 20 key fields, 20 filters, 500 fields to keep or remove.
- Memory: the run reserves 130 bytes per row to compare with 'Keep first' (210 with 'Keep last'), counting every row of the input datasets, the skip datasets and, with 'Only new rows', the output dataset, and allows 75 % of the memory left after 250 MB: rows ≈ (memory in MB − 250) × 0.75 × 1,048,576 ÷ 130 (÷ 210). That is about 4.68 million rows at the default 1 GB (2.90 million with 'Keep last') and 23.3 million at 4 GB (14.4 million). A run that would not fit stops at the start with the memory to choose, before anything is written.
- Default memory: 1 GB, set by the build (
defaultMemoryMbytes1,024); runs started through the API without a memory option used 1,024 MB on the platform. Choose more memory in Run options for big jobs; it also gives more CPU. - Speed (measured on the platform, 1 GB): 12,000 rows read and 10,000 written in 3.6–5.0 s of run time (two runs); counting duplicates in 12,250 rows with 'Keep last' (two passes) took 5.8 s. More memory also gives more CPU.
- Rows: a single row over 9 MB is skipped and counted (Apify datasets cannot store it).
- Timeout: the run stops shortly before its timeout (up to a minute before) and reports it. Re-run with 'Only new rows' into a named dataset to continue.
- One writer per output dataset: do not run two appends into the same named dataset at the same time; a restarted run counts the rows in that dataset to know where it stopped.
- Not supported: run IDs (a limited-permissions Actor cannot open runs; use the run's dataset ID), CSV/Excel uploads, joins (VLOOKUP), fuzzy matching beyond the normalization above.
Use it from your stack
- API (curl):
When you append to a named dataset, read that dataset instead (the run's default dataset stays empty).curl -X POST "https://api.apify.com/v2/acts/klarto~dataset-merge-dedup/run-sync-get-dataset-items?token=YOUR_TOKEN" \-H "Content-Type: application/json" \-d '{"datasets": ["DATASET_ID_1", "DATASET_ID_2"], "dedupFields": ["url"], "normalize": ["trim", "url"]}' - Python (
apify-client):from apify_client import ApifyClientclient = ApifyClient("YOUR_TOKEN")run = client.actor("klarto/dataset-merge-dedup").call(run_input={"datasets": ["DATASET_ID_1", "DATASET_ID_2"], "dedupFields": ["url"]})rows = client.dataset(run.default_dataset_id).list_items().items # apify-client 3.x; 1.x/2.x: run["defaultDatasetId"] - n8n: the Apify node → Run an Actor →
klarto/dataset-merge-dedup, with the input above. - Make / Zapier: the Apify app → Run an Actor.
- MCP / AI agents:
https://mcp.apify.com?tools=klarto/dataset-merge-dedup. The Actor needs no third-party API keys; an Apify account and token are still needed.
FAQ
Why does the run say "No access to dataset"?
This Actor runs with limited permissions. It can read a dataset only when you select it in 'Datasets to merge' or 'Skip rows found in these datasets' (through the API: put the ID or name in datasets or excludeDatasets).
Can I give run IDs instead of dataset IDs?
No. A limited-permissions Actor cannot open runs by ID. Open the run, copy the Dataset ID from its Storage tab and add it to datasets.
Why were no duplicates found?
Usually the key field has another name in your data (for example website, not url). The run then says that no row had a value in the key field and lists the fields it found. Comparing whole rows rarely finds duplicates between two scraper runs, because fields such as scrapedAt differ.
How do I add each new scraper run to one master dataset? Every scraper run writes a new dataset, so pass that run's dataset ID each time and append to one named dataset with 'Only new rows':
from apify_client import ApifyClientclient = ApifyClient("YOUR_TOKEN")scrape = client.actor("YOUR_SCRAPER").call(run_input={...}) # your scraper and its inputclient.actor("klarto/dataset-merge-dedup").call(run_input={"datasets": [scrape.default_dataset_id],"dedupFields": ["url"], "normalize": ["trim", "url"],"outputDataset": "all-leads", "skipExistingInOutput": True})
all-leads then holds each row once; rows already there are skipped and not charged. The same input works from the API, n8n or Make.
Does it change my data? No. Normalization is used only to compare rows. Rows are written exactly as stored, unless you pick, remove or rename fields.
What happens with very large datasets? See Limits: choose more memory for tens of millions of rows. If a run would not fit, it stops at the start and tells you how much memory to choose. If the platform restarts the run (migration), it continues where it stopped.
What am I charged for if a run fails? Only rows that were written, plus the start event. A wrong dataset ID or missing access stops the run before the first row is written.
Fair use and licenses
- Process only data you own or may process. The Actor reads only the datasets you give it and writes only to the output dataset.
- Built with the Apify SDK (Apache-2.0) and orjson (Apache-2.0 or MIT; MPL-2.0 parts, unmodified).
Related Actors
- RSS Feed Reader & Monitor: collect feed items from many feeds, then merge and deduplicate them here.
- HTTP Request Runner: call an API for each cleaned row.
- Bulk File Downloader: download the files linked in the cleaned rows.
- Image Upscaler 2x / 4x: enlarge small images 4×.
Support
Open an issue on the Actor page. We aim to answer within a week.