# Dataset Deduplicate & Merge (Fuzzy) (`larchrow/dataset-dedupe-merge-fuzzy`) Actor

Merge multiple Apify datasets or CSV/JSON/XLSX files and remove duplicates with normalised or fuzzy matching. Only-new mode returns just items you have not seen before.

- **URL**: https://apify.com/larchrow/dataset-dedupe-merge-fuzzy.md
- **Developed by:** [Larchrow](https://apify.com/larchrow) (community)
- **Categories:** Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 1,000 items processeds

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 Deduplicate & Merge (Fuzzy)

**EN** · Merge any number of Apify datasets (plus JSON/CSV URLs) and remove duplicates that simple exact-match dedupers miss:

- **Normalisers per field:** `url` (drops www, trailing slash, utm\_/gclid/fbclid tracking params, sorts query), `phone` (E.164, German 0-prefix → +49), `email` (case, Gmail dots and +tags), `company` (drops GmbH, UG, AG, KG, Ltd, LLC, Inc … and punctuation), `text` (case, accents, whitespace), `exact`.
- **Fuzzy merge** of near-identical names (typos, missing letters) with a safety rule: values that differ by a real word – e.g. *Hospital Rijeka* vs *Hospital Osijek*, *NL Nord* vs *NL Süd* – are **never** merged.
- **Merge strategies:** keep first, keep last, fill empty fields from duplicates, or fill and union list fields. Every output item gets `__dupes` (how many records were merged) and `__source`.
- **Only-new mode:** remembers keys across runs, so a scheduled scraper + this actor outputs only records you have never seen.
- Streaming reads in 10k pages, works with datasets you own (no extra permissions needed). Stats in the key-value store record `STATS`.

Pricing: pay per event, per 1,000 input items processed. No charge for empty runs.

**DE** · Führt beliebig viele Apify-Datasets (und JSON/CSV-URLs) zusammen und entfernt Duplikate, die einfache Exakt-Vergleiche übersehen: URL-, Telefon-, E-Mail- und Firmennamen-Normalisierung (GmbH & Co. KG, UG, AG …), unscharfer Abgleich mit Schutzregel gegen Fehlzusammenführungen, vier Merge-Strategien und ein „nur neue“-Modus für Monitoring.

Hinweis: Das Tool verarbeitet nur Daten, die du selbst einbringst. Für personenbezogene Daten in deinen Datasets bist du Verantwortlicher im Sinne der DSGVO.

Example input:

```json
{"datasetIds":["<run-1-dataset>","<run-2-dataset>"],"fields":["website:url"],"fuzzyField":"name:company","mergeStrategy":"fill"}
```

**New (merged from dataset-tools):** XLSX/JSONL input, `mergeStrategy: most-complete` (keeps the duplicate with the most filled fields), `renameFields`, `fieldsToKeep`, `fieldsToDrop`, `requiredFields`.
**Neu:** XLSX/JSONL-Eingabe, Strategie „most-complete“ (vollständigster Eintrag), Felder umbenennen/auswählen/entfernen, Pflichtfelder.

# Actor input Schema

## `datasetIds` (type: `array`):

Apify datasets to merge (IDs or names). Read in order; earlier datasets win with mergeStrategy=first.

## `sourceUrls` (type: `array`):

Optional public JSON, JSONL, CSV or XLSX files to merge in.

## `items` (type: `array`):

Optional items passed directly.

## `fields` (type: `array`):

Fields forming the key, dot paths allowed. Optional normaliser after a colon: exact, text, url, phone, email, company. Example: website:url or name:company, city:text. Empty = whole item.

## `normalize` (type: `string`):

Default normaliser.

## `mergeStrategy` (type: `string`):

first/last keep one item; most-complete keeps the duplicate with the most filled fields; fill fills empty fields from duplicates; fill-and-combine also unions list fields.

## `fuzzyField` (type: `string`):

e.g. name:company – near-identical values (typos, punctuation) are merged. Different words such as other city names are never merged.

## `fuzzyThreshold` (type: `string`):

Fuzzy threshold.

## `onlyNewAcrossRuns` (type: `boolean`):

Remembers keys in a named key-value store and outputs only items never seen in earlier runs (monitoring).

## `stateKey` (type: `string`):

State store name.

## `skipEmptyKeys` (type: `boolean`):

Items with empty key are kept unmerged.

## `keepEmptyKeyItems` (type: `boolean`):

Keep items with empty key.

## `addSourceField` (type: `boolean`):

Add \_\_source field.

## `addDupeCount` (type: `boolean`):

Add \_\_dupes count.

## `renameFields` (type: `object`):

e.g. {"Firma":"company"}. Applied before dedupe, so key fields use the new names.

## `fieldsToKeep` (type: `array`):

Output only these fields (after renaming). Empty = all.

## `fieldsToDrop` (type: `array`):

Drop fields.

## `requiredFields` (type: `array`):

Items where any of these is empty are dropped.

## Actor input object example

```json
{
  "normalize": "text",
  "mergeStrategy": "first",
  "fuzzyThreshold": "0.92",
  "onlyNewAcrossRuns": false,
  "stateKey": "dedupe-merge-state",
  "skipEmptyKeys": true,
  "keepEmptyKeyItems": true,
  "addSourceField": true,
  "addDupeCount": true,
  "renameFields": {}
}
```

# Actor output Schema

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

Alle Ergebnisse im Standard-Dataset / all results in the default dataset

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("larchrow/dataset-dedupe-merge-fuzzy").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("larchrow/dataset-dedupe-merge-fuzzy").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 '{}' |
apify call larchrow/dataset-dedupe-merge-fuzzy --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,larchrow/dataset-dedupe-merge-fuzzy"
        }
    }
}
```

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/oIP3FIJ1s3g9rMhm1/builds/ziuAVXbzTvVfIrlSD/openapi.json
