# Lead List Deduplicator: Merge Maps, Contacts & Emails (`datacolada/lead-deduplicator`) Actor

Deduplicate and merge Google Maps, Website Contact Finder and Email List Cleaner datasets into one row per company. Joins on shared record IDs, place IDs and emails. Unions contact fields, keeps the best non-empty values, attaches email statuses and a sourceRecords list so you can trace every field.

- **URL**: https://apify.com/datacolada/lead-deduplicator.md
- **Developed by:** [Cyd Dunscombe](https://apify.com/datacolada) (community)
- **Categories:** Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.40 / 1,000 company mergeds

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

## Lead List Deduplicator: Merge Maps, Contacts & Emails

**Deduplicate and merge** lead datasets into **one row per company**. Built to sit after [Google Maps Scraper](https://apify.com/compass/crawler-google-places), [Website Contact Finder](https://apify.com/datacolada/website-contact-finder) and [Email List Cleaner](https://apify.com/datacolada/email-list-cleaner).

This actor is **not a generic CSV concat tool**. It understands company keys, Maps place IDs and shared email record IDs, then unions contact fields and attaches email statuses onto the company row.

### Works well with

| Actor | What it contributes | How rows are joined |
| --- | --- | --- |
| [compass/crawler-google-places](https://apify.com/compass/crawler-google-places) (Google Maps Scraper) | Place, address, phone, rating, Maps URL. Uses the **`website`** field — never the Maps page `url` — as the company site. | `placeId` / `place_id`, and a `recordId` computed from `website` when present |
| [datacolada/website-contact-finder](https://apify.com/datacolada/website-contact-finder) | Company name, domain, emails, phones, social profiles, crawl status | Existing `recordId`, or one computed from `domain` / `website`. Also `source.placeId` |
| [datacolada/email-list-cleaner](https://apify.com/datacolada/email-list-cleaner) | Honest email status (`deliverable_domain`, `invalid`, `risky`, `unknown`, `valid`) | Company `recordId` when the cleaner preserved it, or `emailRecordId` / the email itself |
| [datacolada/store-checker](https://apify.com/datacolada/store-checker) | Verified Shopify/WooCommerce platform, product counts, currency | Existing `recordId`, or one computed from `website` / `domain` |
| [datacolada/lead-leak-audit](https://apify.com/datacolada/lead-leak-audit) | Conversion-hole score and outreach line for the same domain | `recordId` |
| [datacolada/review-gap-analyzer](https://apify.com/datacolada/review-gap-analyzer) | Review reply rates, unanswered 1–2 star counts, reputation-gap score | `recordId` and/or `placeId` |
| [datacolada/hiring-signal-tracker](https://apify.com/datacolada/hiring-signal-tracker) | Whether the company is hiring and what is new since last run | `recordId` |

You can mix those datasets in any combination, add an inline `items` array, or run the merger on a single source to collapse duplicates.

### Input

- **`datasetIds`** — one or more Apify datasets (resource picker, read permission). A single **`datasetId`** alias is also accepted.
- **`items`** — optional inline records with the same shapes as the actors above.
- **`maxItemsPerDataset`** — safety cap, default 50,000.

Under limited permissions the input schema asks for **READ** on each dataset, the same pattern as Email List Cleaner and Website Contact Finder.

### How records are joined

A company cluster is a connected component:

1. Same **`recordId`**, including IDs computed from website / domain / URL with the shared Datacolada namespace (`c09ac79c-0db1-56f1-a341-c8fa33a2da08`). The algorithm matches Website Contact Finder and Email List Cleaner.
2. Same **Google Maps `placeId`** (including Contact Finder's `source.placeId`).
3. Same **`emailRecordId`** / email, used to attach a cleaner row to the company that already lists that address, or to join two company rows that share an on-domain email.

A shared free-provider mailbox (Gmail, Outlook, and similar) does **not** merge two otherwise distinct companies. The cleaner status is still stamped onto every company that listed that address.

Google Maps page URLs (`google.com/maps/...`, `maps.google.com`, and similar) are never treated as the company website.

### What gets merged

- **Union** of emails, phones and social profile URLs.
- **Best non-empty scalars**: Contact Finder company name and domain are preferred when present; E.164 phones beat unformatted ones; a non-role `deliverable_domain` or `valid` email beats a role address as `email`.
- **Email statuses** from Email List Cleaner are attached on `emailDetails`.
- **`sourceRecords`** lists every contributing row (`datasetId`, `datasetItemIndex`, `sourceType`).
- **`conflicts`** flags disagreeing values (for example two company names) without dropping them.

The default dataset is one row per company. A `RUN_SUMMARY` key-value record has input / output counts, joins by key, source-type breakdown and how many rows had conflicts.

### Output fields (overview)

`recordId`, `domain`, `website`, `companyName`, `placeId`, address fields, `phone` / `phones`, `email` / `emails` / `emailDetails`, social URL arrays, Maps rating fields, `mapsUrl`, `sourceRecords`, `sourceTypes`, `inputCounts`, `conflicts`.

### Example input and output

```json
{ "datasetIds": ["CONTACT_FINDER_DATASET_ID", "EMAIL_CLEANER_DATASET_ID"] }
```

A typical output row is one company: shared `recordId`, `domain`, unioned `emails` / `phones`, attached `emailDetails` statuses, and `sourceRecords` so you can see which dataset each field came from. Duplicate input companies are combined, not listed twice.

### FAQ

**Is this a generic CSV concat tool?** No. It joins on company `recordId`, Google Maps `placeId`, and email / `emailRecordId`, then unions contact fields and attaches email statuses.

**Will a shared Gmail address merge two companies?** No. A shared free-provider mailbox does not merge two otherwise distinct companies. The cleaner status is still stamped onto every company that listed that address.

**Are Google Maps page URLs treated as the company website?** No. The merger uses the business `website` field, never `google.com/maps/...`.

### Pricing

**$0.0004 per merged company row** (`lead-merged`, **$0.40 per 1,000 output companies**). There is no start fee. You are charged for each company written to the output dataset after duplicates have been combined, not for each input row.

### Development

```bash
npm install
npm test
```

# Actor input Schema

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

One or more Apify dataset IDs (or console URLs). Each dataset is opened with read permission. Mix Google Maps Scraper rows, Website Contact Finder rows and Email List Cleaner rows in any combination — they are classified automatically.

## `datasetId` (type: `string`):

Optional single dataset, same as adding one entry to datasetIds. Accepts a dataset ID or a console dataset URL.

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

Optional records to merge alongside any datasets. Use this for a quick test or to add a handful of rows without creating a dataset. Objects should look like Maps, Contact Finder or Email List Cleaner output.

## `maxItemsPerDataset` (type: `integer`):

Safety cap on how many rows to read from each dataset. Default 50,000.

## Actor input object example

```json
{
  "maxItemsPerDataset": 50000
}
```

# Actor output Schema

## `companies` (type: `string`):

No description

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

// Run the Actor and wait for it to finish
const run = await client.actor("datacolada/lead-deduplicator").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("datacolada/lead-deduplicator").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 datacolada/lead-deduplicator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datacolada/lead-deduplicator"
        }
    }
}
```

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/w43HwadWLjjg3xwGa/builds/wMJEXys4qBxWks3mn/openapi.json
