# Phone & WhatsApp Validator — Bulk Clean and Normalise (`alaudinburki/phone-number-validator`) Actor

Clean a list of phone numbers at scale: normalise to E.164, validate each against real numbering-plan rules, identify the country, flag line type and duplicates, and reject the junk before you pay to message it.

- **URL**: https://apify.com/alaudinburki/phone-number-validator.md
- **Developed by:** [alaudin burki](https://apify.com/alaudinburki) (community)
- **Categories:** Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

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

## Phone & WhatsApp Number Validator — Bulk Clean, Validate, Normalise

Clean a list **before it costs money to message**. Normalise every number to E.164, validate it
against the real numbering plan, identify the country, flag the duplicates, and reject the junk —
deterministically, offline, and with no API key.

### The problem this solves

A list of 10,000 numbers usually has the same number written four ways, some rows with a country code
and some without, landlines mixed into a mobile campaign, and rows that were never a number. Every one
of those is a paid message that reaches nobody.

### What you get

| Field | Description |
|---|---|
| `input` | The value you gave |
| `e164` | Canonical form, e.g. `+923001234567` — **the join key** |
| `country` | Two-letter country, e.g. `PK`, `GB`, `US` |
| `callingCode`, `national` | Calling code and national number |
| `lineType` | `MOBILE`, `FIXED_LINE`, `FIXED_LINE_OR_MOBILE`, or `null` where the plan carries none |
| `valid` | Passes the real numbering plan |
| `possible` | Right length for the region |
| `isDuplicate` / `duplicateOf` | This number already appeared in this run |
| `mobileCapable` | Suits an SMS/WhatsApp campaign |
| `reason` | Why a row failed — `empty`, `contains_letters`, `unparseable`, `fails_numbering_plan` |

A **SUMMARY** record gives the totals an operator checks before sending: valid, invalid, duplicates,
unique E.164, mobile-capable, and a breakdown by country and line type.

### Sample output

```
4/5 valid · 1 duplicates · 4 mobile-capable · 3 unique
```

```json
{ "input": "0300 1234567", "e164": "+923001234567", "country": "PK",
  "valid": true, "isDuplicate": true, "mobileCapable": true }
```

### Default input

Runs with no editing: five sample numbers, `PK` as the default country.

### What this proves — and what it does not

**It proves** the number is a real number, in which country, of which line type, in canonical form,
and which rows duplicate each other.

**It does NOT prove** the SIM is active, registered, or reachable. It is not an HLR lookup.

**It does NOT check WhatsApp.** The public `wa.me` route returns **HTTP 200 for a fabricated number**,
so it carries no signal — tested, and deliberately not used rather than quietly relied on.

### Limitations

- **Line type is not available for every country.** Pakistan, for example, comes back `null` and is
  counted under `unknown` — the summary says it does not know rather than guessing `MOBILE`. Where
  `lineType` is `null`, `mobileCapable` falls back to validity.
- **A default country coerces.** With `defaultCountry: PK`, `(415) 555-2671` is read as a Pakistani
  national number, because that is what the hint means. Set it only when the list really is
  single-country; otherwise give numbers with a leading `+`.
- **A wrong country is worse than a rejection.** National-format numbers are rejected when no default
  country is set, rather than being guessed into a country that would silently message a stranger.
- Numbering plans change; the library's metadata is a snapshot.

### Pricing

Pay per result.

# Actor input Schema

## `numbers` (type: `array`):

A list of phone numbers to validate. Any format works — the validator normalises them. If they are written in national form (e.g. 0300 1234567) you must also set the default country.

## `defaultCountry` (type: `string`):

Two-letter code used to read numbers written in national form, e.g. PK, US, GB, AE. Leave empty if every number begins with +.

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

Optional: the id of another Apify dataset to validate instead of, or as well as, the list above.

## `valueField` (type: `string`):

When validating a dataset, the field that holds the phone number.

## `dedupe` (type: `boolean`):

Mark rows whose number was already seen in this run.

## `onlyValid` (type: `boolean`):

Drop invalid rows from the output entirely. The summary still counts them.

## `maxItems` (type: `integer`):

Stop after this many.

## Actor input object example

```json
{
  "numbers": [
    "+92 300 1234567",
    "0300 1234567",
    "(415) 555-2671",
    "+44 7911 123456",
    "not-a-number"
  ],
  "defaultCountry": "PK",
  "valueField": "phone",
  "dedupe": true,
  "onlyValid": false,
  "maxItems": 50000
}
```

# Actor output Schema

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

One row per item, with the 11 fields listed under Views.

# 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 = {
    "numbers": [
        "+92 300 1234567",
        "0300 1234567",
        "(415) 555-2671",
        "+44 7911 123456",
        "not-a-number"
    ],
    "defaultCountry": "PK"
};

// Run the Actor and wait for it to finish
const run = await client.actor("alaudinburki/phone-number-validator").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 = {
    "numbers": [
        "+92 300 1234567",
        "0300 1234567",
        "(415) 555-2671",
        "+44 7911 123456",
        "not-a-number",
    ],
    "defaultCountry": "PK",
}

# Run the Actor and wait for it to finish
run = client.actor("alaudinburki/phone-number-validator").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 '{
  "numbers": [
    "+92 300 1234567",
    "0300 1234567",
    "(415) 555-2671",
    "+44 7911 123456",
    "not-a-number"
  ],
  "defaultCountry": "PK"
}' |
apify call alaudinburki/phone-number-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alaudinburki/phone-number-validator"
        }
    }
}
```

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/eA0TfacChd1WhJ3g9/builds/ChTHZ42UtWK2jsgqV/openapi.json
