# Dataset Merge, Fuzzy Dedupe & Cross-Join Pro (`forgekit/dataset-merge-dedupe-pro`) Actor

Merge Apify Datasets, CSV/TSV/JSON/NDJSON/XLSX files & inline rows with exact/normalized/fuzzy deduplication, coalesce survivorship, SQL-style cross-joins, stateful incremental mode, and Standby MCP.

- **URL**: https://apify.com/forgekit/dataset-merge-dedupe-pro.md
- **Developed by:** [James Edmans](https://apify.com/forgekit) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.18 / 1,000 output rows emitted

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/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 Merge, Fuzzy Dedupe & Cross-Join Pro

> **Apify Store Actor:** `forgekit/dataset-merge-dedupe-pro` | **Runtime:** Node.js 22 (lightweight deterministic ETL, 256–1024 MB RAM) | **Billing:** Pay-Per-Event (PPE) + Standby MCP Server

### Overview

**Dataset Merge, Fuzzy Dedupe & Cross-Join Pro** consolidates multiple Apify Datasets, Key-Value Store records, public CSV/TSV/JSON/NDJSON/XML/XLSX file URLs, and inline JSON batches into one clean golden dataset — with zero browser overhead, zero proxy spend, and zero fragile scraping.

Designed for RevOps teams, data engineers, and AI agent pipelines, it combines **exact, normalized, and blocking-accelerated fuzzy deduplication** (`Jaro-Winkler`, `Levenshtein`, `Token-Jaccard`, `Dice`), **smart survivorship coalescing** (`merge-coalesce` & `richest`), **SQL-style cross-joins** (`inner`, `left`, `right`, `full`, `anti`), **stateful incremental `onlyNew` deduplication**, and **formula-safe CSV/XLSX exports** in a single deterministic run.

Built directly around real user feedback from competing Apify Store dataset tools, it isolates unreadable/404 sources into `SUMMARY.sourceErrors[]` instead of crashing mid-run, verifies every exported file is non-empty before writing/charging, explains any zero-row output via `SUMMARY.emptyOutputReason`, and exposes a native **Standby MCP Server** for Claude Desktop, Cursor, and automated AI workflows.

### Features vs Competitors

- **True Blocking-Accelerated Fuzzy Deduplication:** Pure TypeScript `Jaro-Winkler`, `Levenshtein`, `Token-Jaccard`, and `Dice` similarity metrics with explicit (`fuzzyBlockingField`) or automatic prefix+length blocking so 50k+ rows deduplicate cleanly without quadratic blowups.
- **Smart Survivorship (`merge-coalesce` & `richest`):** Instead of silently discarding partial rows, `merge-coalesce` builds a complete golden record (e.g. combining Row A's `email` with Row B's `phone`) while recording `_duplicateCount` and `_fuzzyScore`.
- **Full SQL-Style Cross-Join Engine:** Supports `inner`, `left`, `right`, `full`, and `anti` joins on single or composite keys with case/whitespace/URL normalization and collision-safe column prefixing.
- **Voice-of-Customer Reliability Upgrades:**
  - **Graceful Partial-Source Isolation (`failOnSourceError: false`):** A single 403/404 file URL or missing dataset is captured in `SUMMARY.sourceErrors[]` while remaining valid sources merge cleanly.
  - **Non-Empty Export Verification & Diagnostic `emptyOutputReason`:** Never writes corrupt 0-byte CSV/XLSX files and explicitly explains why 0 rows were emitted (e.g. `"All 50 rows removed by filter rule #1"`).
  - **No-Code Custom `exportFilePrefix` & Source Provenance (`addSourceField`):** Preserves upstream dataset IDs/filenames per row and names KV exports cleanly (`<prefix>_CSV`, `<prefix>_XLSX`).
  - **Zero-Charge Empty Runs & Hard `maxRows` BudgetGuard:** Charges `row-processed` strictly for emitted rows and `file-exported` strictly for verified non-empty artifacts.
- **CSV/XLSX Spreadsheet Formula Safety (`csvFormulaSafe: true`):** Prefixes cells starting with `=`, `+`, `-`, `@`, `\t`, or `\r` with `'` to block spreadsheet formula injection.

| Capability | Dataset Merge, Fuzzy Dedupe & Cross-Join Pro | `lukaskrivka/dedup-datasets-limited-permissions` | `humble-echidna/dataset-transform` | `tidydata/merge-dedupe-datasets` | `saliga/dataset-merge-dedupe` |
|---|---|---|---|---|---|
| Reliability | Deterministic + partial-source isolation | 35.6% success (64% fail rate) | 99.1% | 99.7% | 99.0% |
| Price per 1,000 Rows (FREE) | **$0.25** (`$0.00025/row`) | Platform compute | $1.00 (4x pricier) | $0.25 + $0.005/file | $0.50 (2x pricier) |
| Fuzzy Deduplication | 4 algorithms + blocking acceleration | Exact only | Exact only | Exact only | Exact only |
| Coalesce / Richest Survivorship | `first`, `last`, `richest`, `merge-coalesce` | First only | First only | First only | First only |
| SQL-Style Cross-Joins | `inner`, `left`, `right`, `full`, `anti` | None | None | None | None |
| Stateful `onlyNew` Mode | Named KV store incremental memory | None | None | None | None |
| Standby MCP Server | Native JSON-RPC 2.0 + SSE (3 tools) | None | None | None | None |

### Input Configuration

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `datasetIds` | `string[]` | No | `[]` | Apify Dataset IDs to merge in order (up to 50). |
| `fileUrls` | `string[]` | No | `[]` | Public CSV, TSV, JSON, NDJSON, XML, or XLSX URLs (SSRF-protected, up to 50). |
| `kvsRecords` | `object[]` | No | `[]` | Optional KV store references `[{ storeId?, key, format? }]` (up to 50). |
| `rows` | `object[]` | No | `[]` | Inline JSON row array or source batches `[{ source, rows }]` (up to 50,000). |
| `addSourceField` | `string` | No | `""` | Injects source dataset ID, filename, or batch label under this field name (e.g. `"_source"`). |
| `dedupeMode` | `string` | No | `"normalized"` | Deduplication mode: `"none"`, `"exact"`, `"normalized"`, or `"fuzzy"`. |
| `dedupeFields` | `string[]` | No | `[]` | Dot-notation key fields (empty hashes the full canonicalized row). |
| `keepRowsWithoutKey` | `boolean` | No | `true` | Keep rows missing all `dedupeFields` intact instead of colliding them. |
| `fuzzyAlgorithm` | `string` | No | `"jaro-winkler"` | Fuzzy metric: `"jaro-winkler"`, `"levenshtein"`, `"token-jaccard"`, or `"dice"`. |
| `similarityThreshold` | `number` | No | `0.88` | Minimum similarity score (`0.50`–`1.00`) for fuzzy duplicate clustering. |
| `fuzzyBlockingField` | `string` | No | `""` | Optional blocking column (e.g. `"country"`) to accelerate large fuzzy deduplications. |
| `keepStrategy` | `string` | No | `"first"` | Survivorship rule: `"first"`, `"last"`, `"richest"`, or `"merge-coalesce"`. |
| `mergeArrays` | `boolean` | No | `false` | Union array values across merged duplicates when `keepStrategy="merge-coalesce"`. |
| `normalizeUrlFields` | `string[]` | No | `[]` | Strip protocol, `www.`, UTM/tracking params, and trailing slashes before dedupe/join. |
| `outputDuplicatesToKvs` | `boolean` | No | `false` | Persist rejected duplicates + cluster IDs to KV Store key `DUPLICATES_REPORT`. |
| `join` | `object \| null` | No | `null` | Cross-join config `{ rightDatasetId?, rightFileUrl?, rightRows?, leftKeys[], rightKeys[], type, prefix?, ignoreCase?, cardinality? }`. |
| `filters` | `object[]` | No | `[]` | Filter rules `[{ field, op, value }]` (`eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `regex`, `in`, `exists`, `isEmpty`). |
| `filterLogic` | `string` | No | `"AND"` | Boolean operator combining `filters` (`"AND"` or `"OR"`). |
| `onlyNew` | `boolean` | No | `false` | Stateful incremental mode emitting only unseen keys across scheduled runs. |
| `stateStoreName` | `string` | No | `"dataset-merge-state"` | Named KV store persisting `SEEN_KEYS` for `onlyNew` mode. |
| `selectFields` | `string[]` | No | `[]` | Explicit column whitelist (empty keeps all fields). |
| `dropFields` | `string[]` | No | `[]` | Column blacklist removed before export. |
| `renameFields` | `object` | No | `{}` | Column rename map `{ "oldKey": "newKey" }`. |
| `sortBy` | `object[]` | No | `[]` | Multi-key sort `[{ field, direction: "asc" \| "desc" }]`. |
| `exportFormats` | `string[]` | No | `["json"]` | KV Store export formats (`"json"`, `"ndjson"`, `"csv"`, `"xlsx"`). |
| `exportFilePrefix` | `string` | No | `"merged"` | Sanitized KV artifact filename prefix (`^[a-zA-Z0-9._-]{1,48}$`). |
| `failOnSourceError` | `boolean` | No | `false` | If `false`, isolate 404/403/parse source errors into `SUMMARY.sourceErrors[]`. |
| `csvFormulaSafe` | `boolean` | No | `true` | Prefix leading `=`, `+`, `-`, `@`, `\t`, `\r` cells with `'` in CSV/XLSX exports. |
| `maxRows` | `integer` | No | `100000` | Hard upper cap on emitted output rows (`1`–`500,000`). |

### Output Example

Captured directly from a local end-to-end test run merging two lead batches with fuzzy `merge-coalesce` deduplication (`similarityThreshold: 0.90`), URL canonicalization, and a `left` enrichment join:

```json
{
  "company": "Acme Corp",
  "domain": "https://www.acme.com/?utm_source=google",
  "email": "sales@acme.com",
  "country": "US",
  "_source": "crm-export-a",
  "phone": "+1-415-555-0199",
  "_duplicateCount": 2,
  "_fuzzyScore": 0.98,
  "enrichment_domain": "acme.com",
  "enrichment_arrUsd": 240000,
  "enrichment_tier": "Enterprise"
}
```

Diagnostic `SUMMARY` record persisted to the Key-Value Store:

```json
{
  "inputRowCount": 3,
  "sourcesLoaded": 2,
  "filteredOutCount": 0,
  "exactDuplicatesRemoved": 0,
  "fuzzyDuplicatesMerged": 1,
  "onlyNewSkippedCount": 0,
  "joinMatchedRows": 2,
  "joinUnmatchedLeft": 0,
  "outputRowCount": 2,
  "emptyOutputReason": null,
  "sourceErrors": [],
  "exportedFiles": [
    { "format": "csv", "kvsKey": "merged_CSV", "filename": "merged.csv", "bytes": 338 },
    { "format": "xlsx", "kvsKey": "merged_XLSX", "filename": "merged.xlsx", "bytes": 17080 }
  ],
  "durationMs": 18
}
```

### Pay-Per-Event (PPE) Pricing

| Event Key | Event Title | Price (USD) | Billing Trigger |
|---|---|---:|---|
| `actor-start` | Actor run start | `$0.005` | Charged once per non-empty merge run (waived on 0-row runs). |
| `row-processed` | Output row emitted | `$0.00025` | Charged per merged/deduplicated row pushed to the dataset. |
| `file-exported` | Export file generated | `$0.004` | Charged per verified non-empty KV export file (`csv`, `xlsx`, `json`, `ndjson`). |
| `mcp-tool-call` | Standby MCP tool execution | `$0.003` | Charged per successful Standby MCP JSON-RPC tool invocation. |

**Cost Example:** Merging and deduplicating into `1,000` clean output rows with 1 CSV export costs `$0.005 + (1,000 × $0.00025) + $0.004 = $0.259 USD` — 4× cheaper than `humble-echidna/dataset-transform` (`$1.00/1k`) and 2× cheaper than `saliga/dataset-merge-dedupe` (`$0.50/1k`).

### Standby MCP Server & AI Agent Integration

Enable Apify Standby Mode (`APIFY_META_ORIGIN=STANDBY`) to connect `forgekit/dataset-merge-dedupe-pro` directly to Claude Desktop, Cursor, or any Model Context Protocol (MCP) client:

- **Health Endpoint:** `GET /health`
- **MCP Endpoint:** `POST /mcp` and `GET /mcp` (Streamable HTTP + SSE)
- **Exposed MCP Tools:**
  - `merge_and_dedupe_records` — Merge 2+ inline record arrays with exact/normalized/fuzzy dedupe and survivorship rules.
  - `fuzzy_dedupe_records` — Cluster near-duplicate records via `jaro-winkler`, `levenshtein`, `token-jaccard`, or `dice`.
  - `join_datasets` — Run `inner`, `left`, `right`, `full`, or `anti` SQL-style joins on composite keys.

```json
{
  "mcpServers": {
    "dataset-merge-dedupe-pro": {
      "url": "https://forgekit--dataset-merge-dedupe-pro.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

### Error Handling, Rate Limits & Limitations

- **SSRF & Security Hardening:** All `fileUrls` and `join.rightFileUrl` inputs enforce `http:`/`https:` schemes only and block loopback, RFC 1918 private networks, link-local/cloud metadata (`169.254.169.254`), and internal redirects. Filter `regex` rules enforce a 500-char limit and static ReDoS rejection.
- **Partial Source Resilience:** With `failOnSourceError: false` (default), 404/403 or corrupt file sources are logged in `SUMMARY.sourceErrors[]` without aborting valid sources.
- **File & Memory Bounds:** Remote file fetches are capped at `50 MB` per URL and inline rows at `50,000` records (`maxRows` up to `500,000`). Fuzzy comparisons per auto-generated bucket are capped at `500` candidates to maintain linear-time throughput.

### Quick Start & Example Input

#### 1. Run in Apify Console (No Code)

1. Open **[`forgekit/dataset-merge-dedupe-pro`](https://apify.com/forgekit/dataset-merge-dedupe-pro)** in Apify Console and click **Try for free**.
2. Paste or adjust the ready-to-run input JSON below (safe defaults are pre-filled).
3. Click **Start** and export results as **JSON, CSV, Excel, or NDJSON** from the **Output** tab.

```json
{
  "rows": [
    {
      "company": "Acme Corp",
      "email": "sales@acme.com",
      "country": "US"
    },
    {
      "company": "Acme Corp.",
      "phone": "+1-415-555-0199",
      "country": "US"
    }
  ],
  "exportFormats": [
    "json"
  ],
  "maxRows": 100000
}
```

#### 2. Run via API (`apify-client` — Node.js & Python)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('forgekit/dataset-merge-dedupe-pro').call({"rows":[{"company":"Acme Corp","email":"sales@acme.com","country":"US"},{"company":"Acme Corp.","phone":"+1-415-555-0199","country":"US"}],"exportFormats":["json"],"maxRows":100000});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

```python
from apify_client import ApifyClient
import os

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("forgekit/dataset-merge-dedupe-pro").call(run_input={"rows":[{"company":"Acme Corp","email":"sales@acme.com","country":"US"},{"company":"Acme Corp.","phone":"+1-415-555-0199","country":"US"}],"exportFormats":["json"],"maxRows":100000})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(items)
```

#### 3. Connect to n8n, Make, Zapier & Webhooks

- **n8n / Make / Zapier:** Add the official **Apify** module, choose **Run Actor**, select `forgekit/dataset-merge-dedupe-pro`, and pass the JSON payload above.
- **Schedules & Webhooks:** Attach an Apify Schedule for recurring runs and trigger downstream webhooks automatically on `ACTOR.RUN.SUCCEEDED`.

### Use Cases — What Can You Do With This Data?

- **Automated RevOps & CRM Hygiene:** Chain **Dataset Merge, Fuzzy Dedupe & Cross-Join Pro** directly after any Apify scraper via Apify Integrations, Make, or n8n so clean, schema-validated records land straight in HubSpot, Salesforce, Airtable, or Google Sheets.
- **Scheduled Pipeline Automation:** Trigger runs automatically on dataset completion webhooks with deterministic, zero-hallucination TypeScript logic and predictable per-row Pay-Per-Event pricing.
- **AI & RAG Data Preparation:** Clean, deduplicate, diff, or chunk raw web extractions before embedding into Pinecone, Qdrant, Weaviate, or pgvector without burning LLM tokens on boilerplate.
- **Zero-Code Agency Workflows:** Replace brittle local Python scripts and manual Excel cleanup with reproducible, audit-logged cloud runs exported directly to JSON, CSV, NDJSON, or Excel.

### Frequently Asked Questions (FAQ)

#### How much does Dataset Merge, Fuzzy Dedupe & Cross-Join Pro cost to run?

You only pay for actual output via transparent Pay-Per-Event billing (starting at `$0.00025` per `row-processed` (Output row emitted); see the PPE Pricing table above). Runs that produce zero billable results or fail upstream incur **`$0.00`** — including zero `actor-start` fee — and Apify's built-in **Max total charge** (`ACTOR_MAX_TOTAL_CHARGE_USD`) hard-caps spend automatically.

#### Does this Actor require proxies, logins, or CAPTCHA solving?

No. This Actor performs 100% deterministic local data processing on the inputs you provide (Apify Datasets, Key-Value Stores, inline JSON, or public file URLs). It requires zero proxies, zero headless browsers, and never depends on scraping fragile third-party websites.

#### What export formats and integrations are supported?

Every run stores structured results in an Apify Dataset downloadable as **JSON, CSV, Excel (XLSX), NDJSON, XML, or HTML Table** via Console or REST API, plus native connectors for **n8n, Make, Zapier, Google Sheets, Airtable, Slack, and webhooks**.

#### Can AI agents (Claude Desktop, Cursor, ChatGPT, LangChain) call this Actor directly via MCP?

Yes! **Dataset Merge, Fuzzy Dedupe & Cross-Join Pro** includes a built-in **Standby MCP Server** at `https://forgekit--dataset-merge-dedupe-pro.apify.actor/mcp` supporting JSON-RPC 2.0 (`initialize`, `ping`, `tools/list`, `tools/call`) with Claude-compliant `^[a-zA-Z0-9_.-]{1,64}$` tool schemas.

#### How does it protect against runaway costs or bad inputs?

Every input is strictly validated upfront with Zod schemas before any work starts, user-supplied URLs pass SSRF protection blocking private/cloud-metadata IPs, and streaming `BudgetGuard` enforcement stops immediately once your result or USD budget cap is reached.

#### How fast and lightweight is it compared to browser scrapers?

It runs on lightweight **Node.js 22** (256–512 MB RAM, zero headless browser) so typical runs finish in seconds with high reliability and low platform compute cost.

### Related `forgekit` Actors

Explore companion Actors in **Data Pipeline & ETL** and core ETL utilities to chain end-to-end pipelines:

| Actor | Store Slug | Mode |
|---|---|---|
| [Dataset Diff & Change Detector (Added / Removed / Modified)](https://apify.com/forgekit/dataset-diff-change-detector) | `forgekit/dataset-diff-change-detector` | ✅ Standby MCP |
| [Universal Data Converter & Nested JSON Flattener (JSON, CSV, XLSX, XML, NDJSON, SQLite)](https://apify.com/forgekit/universal-data-converter-flattener) | `forgekit/universal-data-converter-flattener` | ✅ Standby MCP |
| [Lead List Cleaner, Schema Validator & Normalizer (B2B CRM Prep)](https://apify.com/forgekit/lead-cleaner-schema-normalizer) | `forgekit/lead-cleaner-schema-normalizer` | ✅ Standby MCP |
| [Bulk Webhook & Rate-Limited HTTP Batch Dispatcher (Retries, Auth & Capture)](https://apify.com/forgekit/bulk-webhook-http-dispatcher) | `forgekit/bulk-webhook-http-dispatcher` | Batch REST API |
| [RSS, Atom & JSON-Feed Aggregator + New-Item Monitor (MCP Ready)](https://apify.com/forgekit/rss-atom-json-feed-monitor) | `forgekit/rss-atom-json-feed-monitor` | ✅ Standby MCP |
| [PDF-to-Markdown, Clean Text & Metadata Extractor (LLM & RAG Ready + MCP)](https://apify.com/forgekit/pdf-to-markdown-text-extractor) | `forgekit/pdf-to-markdown-text-extractor` | ✅ Standby MCP |
| [Bulk Domain Availability, RDAP/WHOIS Expiry & Multi-TLD Matrix Checker (MCP)](https://apify.com/forgekit/bulk-domain-availability-rdap-matrix) | `forgekit/bulk-domain-availability-rdap-matrix` | ✅ Standby MCP |

# Actor input Schema

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

Apify Dataset IDs to merge in order (local emulation or Apify Cloud).

## `fileUrls` (type: `array`):

Public CSV, TSV, JSON, NDJSON, XML, or XLSX file URLs to ingest (SSRF-protected).

## `kvsRecords` (type: `array`):

Optional Key-Value Store records \[{ storeId?, key }] containing JSON/CSV/XLSX payloads.

## `rows` (type: `array`):

Inline JSON array of row objects or source batches \[{ source, rows }] for direct API/MCP runs.

## `addSourceField` (type: `string`):

If set (e.g. "\_source"), injects the source dataset ID, filename, or batch label into every row.

## `dedupeMode` (type: `string`):

Strategy used to identify duplicate records across merged sources.

## `dedupeFields` (type: `array`):

Dot-notation field paths used as deduplication keys (empty hashes the full canonicalized row).

## `keepRowsWithoutKey` (type: `boolean`):

Preserve rows whose dedupe key fields are all missing/empty instead of collapsing them together.

## `fuzzyAlgorithm` (type: `string`):

String similarity metric used when dedupeMode is set to "fuzzy".

## `similarityThreshold` (type: `number`):

Minimum similarity score (0.50 to 1.00) required to treat two rows as duplicates.

## `fuzzyBlockingField` (type: `string`):

Optional exact/prefix blocking field (e.g. "country" or "domain") to accelerate large fuzzy merges.

## `keepStrategy` (type: `string`):

Determines how winning values are chosen within each duplicate cluster.

## `mergeArrays` (type: `boolean`):

When keepStrategy is "merge-coalesce", union array values across duplicate records.

## `normalizeUrlFields` (type: `array`):

Field paths whose URLs are canonicalized (strip protocol, www., UTM params, trailing slash) before dedupe/join.

## `outputDuplicatesToKvs` (type: `boolean`):

Write rejected duplicate rows and cluster metadata to Key-Value Store key DUPLICATES_REPORT.

## `join` (type: `object`):

Optional SQL-style cross-join specification: { rightDatasetId?, rightFileUrl?, rightRows?, leftKeys\[], rightKeys\[], type: inner|left|right|full|anti, prefix?, ignoreCase?, cardinality?: first-match|all-matches }.

## `filters` (type: `array`):

Filter predicates \[{ field, op, value }] supporting eq, neq, gt, gte, lt, lte, contains, regex, in, exists, isEmpty.

## `filterLogic` (type: `string`):

Combine multiple filter predicates with AND or OR.

## `onlyNew` (type: `boolean`):

Emit only keys unseen in previous runs persisted in stateStoreName.

## `stateStoreName` (type: `string`):

Named Apify Key-Value Store used to persist seen hashes when onlyNew is enabled.

## `selectFields` (type: `array`):

Explicit list of output column names to retain (empty keeps all columns).

## `dropFields` (type: `array`):

Output column names to exclude from emitted records.

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

Map of { "oldField": "newField" } column renames applied before export.

## `sortBy` (type: `array`):

Multi-key sort specification \[{ field, direction: "asc"|"desc" }].

## `exportFormats` (type: `array`):

Output file formats to export to the Key-Value Store (json, ndjson, csv, xlsx).

## `exportFilePrefix` (type: `string`):

Sanitized filename prefix for exported KV Store artifacts (e.g. "merged" -> merged_CSV, merged_XLSX).

## `failOnSourceError` (type: `boolean`):

When false (default), unreadable/404 sources are isolated in SUMMARY.sourceErrors\[] while valid sources still merge.

## `csvFormulaSafe` (type: `boolean`):

Prefix cells starting with =, +, -, @, tab, or CR with an apostrophe in CSV/XLSX exports.

## `maxRows` (type: `integer`):

Hard upper cap on emitted output records.

## Actor input object example

```json
{
  "datasetIds": [],
  "fileUrls": [],
  "kvsRecords": [],
  "rows": [
    {
      "company": "Acme Corp",
      "email": "sales@acme.com",
      "country": "US"
    },
    {
      "company": "Acme Corp.",
      "phone": "+1-415-555-0199",
      "country": "US"
    }
  ],
  "addSourceField": "",
  "dedupeMode": "normalized",
  "dedupeFields": [],
  "keepRowsWithoutKey": true,
  "fuzzyAlgorithm": "jaro-winkler",
  "similarityThreshold": 0.88,
  "fuzzyBlockingField": "",
  "keepStrategy": "first",
  "mergeArrays": false,
  "normalizeUrlFields": [],
  "outputDuplicatesToKvs": false,
  "filters": [],
  "filterLogic": "AND",
  "onlyNew": false,
  "stateStoreName": "dataset-merge-state",
  "selectFields": [],
  "dropFields": [],
  "renameFields": {},
  "sortBy": [],
  "exportFormats": [
    "json"
  ],
  "exportFilePrefix": "merged",
  "failOnSourceError": false,
  "csvFormulaSafe": true,
  "maxRows": 100000
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `duplicatesReport` (type: `string`):

No description

## `ppeLedger` (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 = {
    "rows": [
        {
            "company": "Acme Corp",
            "email": "sales@acme.com",
            "country": "US"
        },
        {
            "company": "Acme Corp.",
            "phone": "+1-415-555-0199",
            "country": "US"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("forgekit/dataset-merge-dedupe-pro").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 = { "rows": [
        {
            "company": "Acme Corp",
            "email": "sales@acme.com",
            "country": "US",
        },
        {
            "company": "Acme Corp.",
            "phone": "+1-415-555-0199",
            "country": "US",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("forgekit/dataset-merge-dedupe-pro").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 '{
  "rows": [
    {
      "company": "Acme Corp",
      "email": "sales@acme.com",
      "country": "US"
    },
    {
      "company": "Acme Corp.",
      "phone": "+1-415-555-0199",
      "country": "US"
    }
  ]
}' |
apify call forgekit/dataset-merge-dedupe-pro --silent --output-dataset

```

## MCP server setup

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

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/wmGqPMGAtEjFX9a7N/builds/F6m0QjhwDQY3xsezb/openapi.json
