# Lead List Cleaner (`zakodata/lead-list-cleaner`) Actor

Clean business lead lists in seconds: remove duplicates, personal emails (Gmail, Yahoo...), social media links and incomplete rows.

- **URL**: https://apify.com/zakodata/lead-list-cleaner.md
- **Developed by:** [zako data](https://apify.com/zakodata) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Cleaner

Turn a messy list of business leads into a clean, ready-to-use list. Paste your leads, upload a CSV link, or connect the output of another Apify Actor (for example a Google Maps scraper).

### What it does

- Removes **duplicate** leads (same email or same phone number)
- Removes **personal emails** (Gmail, Yahoo, Hotmail, Outlook, iCloud...) and keeps business emails
- Removes **fake or broken emails** (image file names, no-reply addresses, placeholder domains)
- Drops **social media links** (Facebook, Instagram, LinkedIn...) used in place of a real website
- Drops rows with **no name**, and optionally rows with no email, phone or website
- Picks a **primary email** per lead and labels it `generic` (info@, contact@...) or `named`
- Returns a tidy table with a short summary of what was removed

### Input

Provide **one** data source:

| Field | Description |
| --- | --- |
| `datasetId` | ID of an Apify dataset, for example from a Google Maps Scraper run |
| `csvUrl` | Public link to a CSV or JSON file. The first CSV row must contain column names |
| `leads` | Leads pasted directly as a JSON list |

Options:

| Field | Default | Description |
| --- | --- | --- |
| `requireEmail` | `true` | Remove rows without a valid business email |
| `requirePhone` | `false` | Remove rows without a phone number |
| `requireWebsite` | `false` | Remove rows without a real website |
| `removePersonalEmails` | `true` | Remove free-mail addresses |
| `removeDuplicates` | `true` | Remove rows sharing an email or phone number |

Recognized column names (case-insensitive): `title` / `name` / `companyName`, `phone` / `phoneNumber`, `email` / `emails`, `website`, `address`, `city`, `state`, `categoryName` / `category`.

#### Example input

```json
{
    "leads": [
        {
            "title": "Example Realty",
            "phone": "(305) 555-0100",
            "website": "https://www.example-realty.com/",
            "emails": ["info@example-realty.com", "agent@gmail.com"]
        }
    ],
    "requireEmail": true,
    "removePersonalEmails": true
}
```

### Output

One row per cleaned lead:

```json
{
    "name": "Example Realty",
    "phone": "(305) 555-0100",
    "email": "info@example-realty.com",
    "emailType": "generic",
    "extraEmails": "",
    "website": "https://www.example-realty.com/",
    "address": "",
    "city": "",
    "state": "",
    "category": ""
}
```

A `SUMMARY` record is also saved with the number of rows kept and removed, and why. Download the results as Excel, CSV or JSON from the **Output** tab.

### Good to know

- The Actor only cleans and reorganizes the data you give it. It does not collect new data and does not verify that an email address is actually deliverable.
- Make sure you have the right to use the contact data you process, and that your use complies with the laws that apply to you and your recipients (for example email and phone marketing rules).

# Actor input Schema

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

ID of a dataset from another Actor run (for example a Google Maps Scraper run). Leave empty if you use another source.

## `csvUrl` (type: `string`):

Public link to a CSV or JSON file with your leads. The first CSV row must contain column names (name, phone, email, website...).

## `leads` (type: `array`):

Paste your leads directly as a JSON list of objects. Used only when Dataset ID and File URL are empty.

## `requireEmail` (type: `boolean`):

Keep only leads that have at least one valid email.

## `requirePhone` (type: `boolean`):

Keep only leads that have a phone number.

## `requireWebsite` (type: `boolean`):

Keep only leads that have a real website (social media pages do not count).

## `removePersonalEmails` (type: `boolean`):

Free-mail addresses are dropped so that only business emails remain.

## `removeDuplicates` (type: `boolean`):

Rows sharing the same email or phone number are merged into one.

## Actor input object example

```json
{
  "leads": [
    {
      "title": "Example Realty",
      "phone": "(305) 555-0100",
      "website": "https://www.example-realty.com/",
      "emails": [
        "info@example-realty.com",
        "agent@gmail.com"
      ]
    }
  ],
  "requireEmail": true,
  "requirePhone": false,
  "requireWebsite": false,
  "removePersonalEmails": true,
  "removeDuplicates": true
}
```

# Actor output Schema

## `cleanedLeads` (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 = {
    "leads": [
        {
            "title": "Example Realty",
            "phone": "(305) 555-0100",
            "website": "https://www.example-realty.com/",
            "emails": [
                "info@example-realty.com",
                "agent@gmail.com"
            ]
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zakodata/lead-list-cleaner").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 = { "leads": [{
            "title": "Example Realty",
            "phone": "(305) 555-0100",
            "website": "https://www.example-realty.com/",
            "emails": [
                "info@example-realty.com",
                "agent@gmail.com",
            ],
        }] }

# Run the Actor and wait for it to finish
run = client.actor("zakodata/lead-list-cleaner").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 '{
  "leads": [
    {
      "title": "Example Realty",
      "phone": "(305) 555-0100",
      "website": "https://www.example-realty.com/",
      "emails": [
        "info@example-realty.com",
        "agent@gmail.com"
      ]
    }
  ]
}' |
apify call zakodata/lead-list-cleaner --silent --output-dataset

```

## MCP server setup

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

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/exBE7wlqPihNv7Ibf/builds/JvRPYDaXuyabDP7zA/openapi.json
