# Website Email & Phone Scraper with Branch Matching (`suerte_enero/website-email-phone-scraper-branch-matching`) Actor

Extract public business emails and phone numbers from websites. Match contacts to the right branch by city and address, distinguish company-wide numbers, and get source URLs with confidence and crawl coverage. Export to JSON, CSV or Excel for lead enrichment and workflows.

- **URL**: https://apify.com/suerte_enero/website-email-phone-scraper-branch-matching.md
- **Developed by:** [Eduard Kalyta](https://apify.com/suerte_enero) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 website analyzeds

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

## Website Email & Phone Scraper with Branch Matching

Extract published business emails and phone numbers from company websites, then identify which contacts belong to the location you need. Every contact includes a source URL and is classified as branch, company-wide, or unknown.

### What you get

- Emails and phone numbers from public HTTPS pages, contact links, and structured business data.
- Branch matching using a city and optional street, postal code, country, or known location page.
- Source evidence and confidence for each contact, plus explicit crawl errors and coverage limits.
- One Dataset row per unique target, ready to export as JSON, CSV, or Excel and use through the Apify API, Make, or n8n.

Useful for enriching business directories, preparing location-specific contact lists, and separating a local branch from a company's main number. No external AI key or proxy subscription is required by the code.

### Input example

```json
{
  "targets": [
    {
      "id": "my-business-1",
      "url": "https://company.example/",
      "city": "London",
      "street": "10 High Street",
      "locationUrl": "https://company.example/locations/london"
    }
  ],
  "maxPagesPerSite": 12,
  "maxTargets": 20
}
```

Replace the example domain with the business website you want to analyze. Only url is required. Omit city to discover general company contacts. A known locationUrl must use the same website host; www redirects are supported.

### Understanding your results

Each row includes id, url, target, status, branchMatch, contacts, coverage, and sourcePages. Contact entries contain type, value, scope, confidence, and source evidence. The SUMMARY record reports successful sites, failures, branch matches, duplicates, charges, and budget stops.

- COMPLETE: the selected crawl queue completed.
- PARTIAL: the crawl hit a cap, stopped early, or encountered a page error. Inspect coverage.
- FAILED: no page was successfully fetched.
- branchMatch is true only when at least one contact meets the branch matching rules. A fetched site without a branch match can still return useful company contacts.

### How branch matching works

The crawler prioritizes contact and location pages. It extracts mailto and tel links, visible emails and international phone numbers, and Schema.org business data. A branch claim requires a matching structured address with an attached contact, or a city-matching location page or heading with a contact not repeated elsewhere. Repeated footer contacts are classified as company-wide; weak evidence stays unknown.

### Limits

Up to 100 targets and 25 pages per site can be configured; defaults are 20 targets and 12 pages. The crawler checks a 90-second site deadline between requests. It supports public HTTPS pages, validates and pins DNS addresses, and rejects private networks, credentials, nonstandard ports, oversized pages, and unrelated-host redirects.

JavaScript-only locators, PDFs, images, separate location domains, and bot-protected pages may not work. The Actor does not verify email deliverability or whether a phone answers. Results are published contact information, not verified leads. Respect website restrictions and applicable data-use rules.

### Billing

When pay-per-event pricing is enabled, the site-analyzed event is charged once per unique target with at least one successfully fetched page. Failed targets are not charged this event. A branch match is not guaranteed. Check the Store pricing panel for the current rate. Without pay-per-event pricing, successful results are still saved without event charges.

### Local development

Requires Node.js 22+. Install with npm ci, put input in storage/key_value_stores/default/INPUT.json, and run npm start. Run npm test for deterministic extraction, matching, network-safety, and billing tests.

# Actor input Schema

## `targets` (type: `array`):

Array of {url, city?, street?, postalCode?, country?, locationUrl?, id?}. When city or street is omitted, returns general company contacts without claiming a branch match.

## `maxPagesPerSite` (type: `integer`):

Upper bound for HTTP pages fetched for each target website.

## `maxTargets` (type: `integer`):

Upper bound for the number of websites in this run.

## Actor input object example

```json
{
  "targets": [
    {
      "url": "https://example.com",
      "city": "Example City"
    }
  ],
  "maxPagesPerSite": 12,
  "maxTargets": 20
}
```

# Actor output Schema

## `contacts` (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 = {
    "targets": [
        {
            "url": "https://example.com",
            "city": "Example City"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("suerte_enero/website-email-phone-scraper-branch-matching").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 = { "targets": [{
            "url": "https://example.com",
            "city": "Example City",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("suerte_enero/website-email-phone-scraper-branch-matching").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 '{
  "targets": [
    {
      "url": "https://example.com",
      "city": "Example City"
    }
  ]
}' |
apify call suerte_enero/website-email-phone-scraper-branch-matching --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,suerte_enero/website-email-phone-scraper-branch-matching"
        }
    }
}
```

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/WECCuzV3wsV3gVyP9/builds/37vk7gNc8u1F9kfT8/openapi.json
