# SiteVerdict — Phone Number Validator & Formatter (Bulk) (`siteverdict/siteverdict-phone-validator`) Actor

Validate and format phone numbers in bulk for 240+ countries: valid/possible, E.164, international and national formats, mobile/landline/VoIP/toll-free type, country, duplicates and fiction/test ranges. Offline metadata, no lookups of people.

- **URL**: https://apify.com/siteverdict/siteverdict-phone-validator.md
- **Developed by:** [Aman Thakran](https://apify.com/siteverdict) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 number validateds

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 Number Validator & Formatter: clean 100,000 numbers in one run

**Check, standardise and de-duplicate phone numbers from 240+ countries in bulk.** You get a valid/invalid verdict with the reason, the E.164, international and national formats, the number type (mobile, landline, VoIP, toll-free, premium rate...) and the country. Numbers in the drama/test ranges reserved by Ofcom, NANPA and ACMA are flagged too.

Everything runs **offline** on Google's libphonenumber numbering-plan metadata. We never call a carrier, an HLR service or any "who owns this number" database, and we never send your numbers to a third party.

### Who it is for

- **CRM and marketing ops:** normalise a messy contact export to E.164 before an SMS or WhatsApp campaign, and drop invalid and duplicate rows first.
- **Developers and data teams:** validate sign-up form numbers in batch, or as one step in an Apify pipeline that reads another Actor's dataset.
- **Agents (MCP):** a fast, deterministic `validate_phone_numbers` tool that returns structured JSON.

### What you get per number

| Field | Example |
|---|---|
| `status` / `valid` / `possible` | `valid` / `true` / `true` |
| `e164` | `+447700900123` |
| `international` / `national` | `+44 7700 900123` / `07700 900123` |
| `rfc3966` / `telUri` | `tel:+447700900123` |
| `type` / `typeLabel` / `isMobile` | `MOBILE` / `Mobile` / `true` |
| `country` / `countryName` / `countryCallingCode` | `GB` / `United Kingdom` / `44` |
| `possibleCountries` | `["GB"]` (shared calling codes such as +1 list every candidate) |
| `extension` | `123` (from "ext. 123") |
| `fictionalOrTest` | `Ofcom drama/fiction range (mobile 07700 900xxx)` |
| `duplicateOf` | index of the first occurrence (same E.164 + extension) |
| `error` / `lengthCheck` | `Too short to be a phone number.` / `TOO_SHORT` |
| `sha256` (optional) | salted hash of the E.164, for privacy-preserving matching |

The format examples use the Ofcom drama number 07700 900123, which this Actor itself reports as `invalid` (reserved for fiction, never assigned); a real, assigned mobile gets `valid` and `MOBILE` as shown in the other rows.

You also get `NUMBERS.csv` (safe against spreadsheet formula injection) and an `OUTPUT` summary with counts by status, type and country.

### Before and after

Input (default country GB):

```
07700 900123 | +44 7700 900123 | 020 7946 0018 | 12345 | not a phone
```

Output (abridged):

| input | status | e164 | type | note |
|---|---|---|---|---|
| 07700 900123 | invalid | +447700900123 | | Reserved for drama/fiction or testing |
| +44 7700 900123 | *(duplicate, removed)* | | | duplicateOf 0, not charged |
| 020 7946 0018 | valid | +442079460018 | FIXED_LINE | Ofcom drama/fiction range |
| 12345 | invalid | +4412345 | | Too short to be a phone number |
| not a phone | parse_error | | | Does not look like a phone number |

### Inputs

- **Phone numbers**: a list in any common format (spaces, brackets, dashes, `00` or `+` prefixes, `ext.`).
- **Default country**: used for numbers written without `+`. Leave it empty to accept international numbers only.
- **Paste numbers or text**: one number per line. Turn on **Find numbers inside text** to pull numbers out of e-mails or notes.
- **Records (JSON)**: `{phone, country, label}` objects. The label is echoed back so you can join the results to your data.
- **Dataset**: read numbers from another Apify dataset (`datasetId`, `datasetField`, optional `datasetCountryField`).
- **Privacy options**: `maskNumbers` (output shows only the first 2 and last 3 digits) and `includeHash` with a secret `hashSalt`.

### Pricing

Pay per event: **$0.0005 per number validated** ($0.50 per 1,000).

- 1,000 numbers ≈ $0.50
- 10,000 numbers ≈ $5
- 100,000 numbers ≈ $50

Duplicates (when **Remove duplicates** is on), empty lines and over-long inputs are never charged. The run stops cleanly at your maximum total charge.

### FAQ

**Does "valid" mean the line is active or reachable?** No. "Valid" means the number fits an assigned range in the national numbering plan. Checking whether a line is live needs a carrier/HLR lookup, which we deliberately don't do.

**Do you return the carrier name?** No. The open libphonenumber metadata does not include carrier or owner data. You get the number *type* (mobile, landline, VoIP...). Number portability also makes carrier-by-prefix unreliable.

**Why is 07700 900123 invalid?** Ofcom reserves that range for TV and radio drama, so it is never assigned to anyone. We flag these ranges so test data doesn't end up in your CRM.

**Which countries?** Every region in libphonenumber, 240+ countries and territories, plus non-geographic codes such as +800 and +870.

**How fast is it?** Thousands of numbers per second. A 100,000-number run is usually limited by dataset writes, not validation.

### Run time, aborts and partial results

- **Run time:** all numbers are validated first (in memory, offline), then saved to the dataset in batches of 500. Small lists finish in seconds; a 100,000-number run is mostly dataset writing. Memory above the default does not make it faster.
- **Charged per saved batch:** each batch is charged right after it is saved, and only for valid, invalid and unparseable numbers (duplicates removed by "Remove duplicates", which is on by default, too-long inputs and numbers dropped by "Only output valid numbers" are free). If you abort the run or it times out, the batches already saved stay in the dataset and were charged; nothing else is charged.
- **Saved only at the end:** `NUMBERS.csv` and the `OUTPUT` summary are written when the run finishes, so an aborted run has neither. If the run's maximum charge is reached, the remaining numbers are not output and the log says how many were skipped.
- **Input errors fail fast:** a field of the wrong type (for example a single string instead of a list) stops the run before any work with an "Input problem" message, and nothing is charged.

### Limits

- Up to 100,000 numbers per run and 64 characters per number (longer inputs are reported as `too_long_input` and not charged).
- Validation reflects the bundled metadata release (libphonenumber-js 1.13.14). Ranges opened after that release may show as invalid until we update.
- There is no reachability, carrier, porting, owner or spam-score data, by design.

### Sources & compliance

- **Data:** [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) (MIT), built on Google [libphonenumber](https://github.com/google/libphonenumber) metadata (Apache-2.0). Bundled with the Actor; no network calls. Checked 11 Oct 2026.
- **Fiction/test ranges:** Ofcom "Telephone numbers for drama purposes", NANPA 555-0100 to 555-0199, and ACMA "Phone numbers for use in creative works". The ACMA mobile block is flagged as a block; only the specific listed numbers are reserved.
- **Personal data (UK GDPR / PECR):** a phone number can be personal data. This Actor only processes the numbers you supply and enriches nothing about individuals. Use `maskNumbers` or `includeHash` to limit what is stored. You need a lawful basis to hold the numbers, and under PECR consent before sending marketing texts or making marketing calls (check TPS/CTPS for UK calls). This is not legal advice.
- The hash salt is a secret input. It is never logged or written to the output. Without a salt (or with a short one) the `sha256` column is a plain SHA-256 of the E.164 number, the form some ad platforms use for matching; phone numbers are easy to guess, so a plain hash is not anonymisation, and the run log warns about it.
- **Retention:** results are written only to storages in your own Apify account (the run's dataset and key-value store) and follow your Apify plan's data-retention period. Nothing is sent anywhere else: validation is offline.

Built by SiteVerdict (BharatFare Travel and Technologies Ltd, UK). Contact: Use the Issues tab on this Actor's Store page.

# Changelog

This Actor's version history is a separate document: https://apify.com/siteverdict/siteverdict-phone-validator/changelog.md

# Actor input Schema

## `phoneNumbers` (type: `array`):

Numbers in any common format: +44 7700 900123, (020) 7946 0018, 001-202-555-0143, 07700900123 ext. 12. Numbers without a + prefix are read using the default country.

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

Two-letter country code (GB, US, IN, DE, AU...) used for numbers written without a +country code. Leave empty to accept only international (+) numbers.

## `text` (type: `string`):

One number per line, or free text (e-mails, notes) when "Find numbers inside text" is on. Up to 2 million characters.

## `extractFromText` (type: `boolean`):

Scan the pasted text for phone numbers instead of reading it line by line.

## `records` (type: `array`):

Optional objects like {"phone": "07700 900123", "country": "GB", "label": "CRM-42"}. A per-record country overrides the default country; the label is echoed back so you can join results to your data.

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

Optional: ID of an Apify dataset whose items contain phone numbers (e.g. the output of another Actor).

## `datasetField` (type: `string`):

Field name that holds the number in each dataset item.

## `datasetCountryField` (type: `string`):

Field name holding a 2-letter country code per item.

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

Output each distinct number (same E.164 + extension) once. Duplicates are not charged.

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

Drop invalid numbers from the dataset (they still appear in the summary counts and are not charged).

## `maskNumbers` (type: `boolean`):

Privacy mode: hide all but the first 2 and last 3 digits in the output (validation still uses the full number).

## `includeHash` (type: `boolean`):

Adds a salted SHA-256 of the E.164 number so you can match records without storing the number.

## `hashSalt` (type: `string`):

Optional secret salt for the hash. Never logged or output.

## `writeCsv` (type: `boolean`):

Also save NUMBERS.csv to the key-value store.

## `maxNumbers` (type: `integer`):

Safety cap for one run (max 100,000).

## Actor input object example

```json
{
  "phoneNumbers": [
    "+44 7700 900456",
    "020 7946 0018",
    "+1 (202) 555-0143",
    "+61 491 570 156",
    "07700 900123",
    "12345"
  ],
  "defaultCountry": "GB",
  "extractFromText": false,
  "datasetField": "phone",
  "dedupe": true,
  "onlyValid": false,
  "maskNumbers": false,
  "includeHash": false,
  "writeCsv": true,
  "maxNumbers": 100000
}
```

# Actor output Schema

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

No description

## `output` (type: `string`):

No description

## `files` (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 = {
    "phoneNumbers": [
        "+44 7700 900456",
        "020 7946 0018",
        "+1 (202) 555-0143",
        "+61 491 570 156",
        "07700 900123",
        "12345"
    ],
    "defaultCountry": "GB"
};

// Run the Actor and wait for it to finish
const run = await client.actor("siteverdict/siteverdict-phone-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 = {
    "phoneNumbers": [
        "+44 7700 900456",
        "020 7946 0018",
        "+1 (202) 555-0143",
        "+61 491 570 156",
        "07700 900123",
        "12345",
    ],
    "defaultCountry": "GB",
}

# Run the Actor and wait for it to finish
run = client.actor("siteverdict/siteverdict-phone-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 '{
  "phoneNumbers": [
    "+44 7700 900456",
    "020 7946 0018",
    "+1 (202) 555-0143",
    "+61 491 570 156",
    "07700 900123",
    "12345"
  ],
  "defaultCountry": "GB"
}' |
apify call siteverdict/siteverdict-phone-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,siteverdict/siteverdict-phone-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/IOvVmBzLgfNEJeZ2C/builds/AyziXWhmnAgbwZRi6/openapi.json
