# Email Pattern Inference — From Known Name/Email Examples (`pontio/email-pattern-inference`) Actor

Infer one of ten email formats from supplied name/email examples. Offline and unverified: no website discovery, generated addresses or deliverability checks. Ambiguous and insufficient evidence is uncharged.

- **URL**: https://apify.com/pontio/email-pattern-inference.md
- **Developed by:** [Gabor Molnar](https://apify.com/pontio) (community)
- **Categories:** Developer tools, Lead generation, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 email pattern inferreds

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

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

## Email Pattern Inference

Compare known name/email examples for a company and return the common format
that fits them. **Offline and unverified:** this does not find emails, fetch
websites, generate addresses or check whether a mailbox exists or accepts mail.

### Input

```json
{
  "companies": [
    {
      "domain": "example.com",
      "examples": [
        { "firstName": "Alice", "lastName": "Smith", "email": "alice.smith@example.com" },
        { "firstName": "Robert", "lastName": "Jones", "email": "robert.jones@example.com" }
      ]
    }
  ]
}
```

Supply 1–50 evidence groups, each with 1–20 **observed** name/email pairs. You
must have permission to process these examples. Use a bare email domain, not
a URL. Email domains are matched exactly: `www.example.com` and
`mail.example.com` are not merged with `example.com`. Case, surrounding
whitespace, IDNs and a trailing domain dot normalize. A bare public suffix
such as `co.uk` is not an email domain. The exact normalized ASCII host,
including any `www.` prefix, must be at most 253 characters with DNS labels
of at most 63 characters; an IDN that exceeds these limits after punycoding
returns free `invalid_domain`.

Names must be single ASCII-letter tokens after NFKC normalization, trimming
and case folding. Accents, hyphens, apostrophes and multi-part names are
unsupported, not transliterated or silently omitted. Email local parts get the
same NFKC normalization and case folding for format comparison; this does not prove case-insensitive
mailbox delivery. Unsupported or wrong-domain examples invalidate the group.

Formats considered (`f` / `l` mean first / last initial):
`first.last`, `firstlast`, `f.last`, `flast`, `first.l`, `firstl`,
`last.first`, `lastfirst`, `first`, `last`.
No other naming conventions are inferred.

Identical normalized groups are processed once, including reordered examples
and duplicate observations. Different evidence sets for one domain remain
separate rows and can each bill. Distinct invalid groups remain separate.

### Output

```json
{
  "domain": "example.com",
  "evidenceCount": 2,
  "pattern": "first.last",
  "candidates": ["first.last"],
  "verified": false,
  "reasonCode": "inferred"
}
```

An inference requires at least two distinct names **and** mailboxes, and
exactly one supported format matching every distinct observation. Multiple
addresses for one name or one mailbox shared between names yield
`unknown_pattern`; repeats of one pair are insufficient. `candidates` shows
formats fitting the supplied evidence, including on insufficient/ambiguous
results, but `pattern` is null unless inferred. These are hypotheses based on
your examples, **not** a company-wide policy, identity or deliverability
assertion. An unknown pattern does not mean an address is invalid.

Output omits names and email addresses, but Apify stores the submitted run
input. Do not submit private contact data without the necessary permissions;
configure retention/deletion in your account.

### Billing

The billing unit is one inferred evidence group, not one email or company-wide
verification. Unresolved evidence is not charged.

| `reasonCode` | Meaning | Charged? |
| --- | --- | --- |
| `inferred` | One supported format fits all independent observations | yes |
| `invalid_domain` | Not a supported bare email domain | no |
| `invalid_examples` | Unsupported names/emails or wrong-domain examples | no |
| `insufficient_evidence` | Fewer than two distinct observations | no |
| `ambiguous` | More than one supported format fits | no |
| `unknown_pattern` | Conflicting/unsupported convention or non-independent evidence | no |

### Limits

No discovery, SMTP, DNS, search, policy cache or history comparison.
Two examples can fit one convention while other employees use another.
Use a separate verification tool before treating an address as deliverable.
Malformed batch shapes and over-limit strings are rejected at input validation.
When the platform reports its charge limit, the sequential adapter stops
starting further groups; remaining groups have no row.

# Changelog

This Actor's version history is a separate document: https://apify.com/pontio/email-pattern-inference/changelog.md

# Actor input Schema

## `companies` (type: `array`):

Up to 50 evidence groups. Identical normalized groups (including reordered/repeated examples) produce one row and at most one charge; different evidence for the same domain stays separate. JSON editor. Offline, unverified: no website fetch, SMTP or generated addresses.

## Actor input object example

```json
{
  "companies": [
    {
      "domain": "example.com",
      "examples": [
        {
          "firstName": "Alice",
          "lastName": "Smith",
          "email": "alice.smith@example.com"
        },
        {
          "firstName": "Robert",
          "lastName": "Jones",
          "email": "robert.jones@example.com"
        }
      ]
    }
  ]
}
```

# Actor output Schema

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

Results produced by this run, in its 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 = {
    "companies": [
        {
            "domain": "example.com",
            "examples": [
                {
                    "firstName": "Alice",
                    "lastName": "Smith",
                    "email": "alice.smith@example.com"
                },
                {
                    "firstName": "Robert",
                    "lastName": "Jones",
                    "email": "robert.jones@example.com"
                }
            ]
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pontio/email-pattern-inference").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 = { "companies": [{
            "domain": "example.com",
            "examples": [
                {
                    "firstName": "Alice",
                    "lastName": "Smith",
                    "email": "alice.smith@example.com",
                },
                {
                    "firstName": "Robert",
                    "lastName": "Jones",
                    "email": "robert.jones@example.com",
                },
            ],
        }] }

# Run the Actor and wait for it to finish
run = client.actor("pontio/email-pattern-inference").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 '{
  "companies": [
    {
      "domain": "example.com",
      "examples": [
        {
          "firstName": "Alice",
          "lastName": "Smith",
          "email": "alice.smith@example.com"
        },
        {
          "firstName": "Robert",
          "lastName": "Jones",
          "email": "robert.jones@example.com"
        }
      ]
    }
  ]
}' |
apify call pontio/email-pattern-inference --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pontio/email-pattern-inference"
        }
    }
}
```

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/Kx7bRitBcfMY2T3RW/builds/L3dd5Ha7jMjWCmdcd/openapi.json
