# Bulk Phone Number Validator & Formatter (Offline, 240+) (`beryline_pastel/bulk-phone-number-validator`) Actor

Validate and format thousands of phone numbers offline using libphonenumber. Get validity, line type (mobile, landline, VoIP, toll-free), country, E.164, international, national and RFC3966 formats, failure reasons and duplicates.

- **URL**: https://apify.com/beryline_pastel/bulk-phone-number-validator.md
- **Developed by:** [Beryline Pastel](https://apify.com/beryline_pastel) (community)
- **Categories:** Lead generation, Developer tools, Automation
- **Features:** 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 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/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

## Bulk Phone Number Validator & Formatter (Offline, 240+)

Clean a phone list in minutes. Paste numbers (or a CSV column) and get, **for every row**: is it valid, is it possible, which country, which line type (mobile, landline, toll-free, VoIP...), and the number rewritten as **E.164, international, national and RFC3966 (`tel:`)** — plus the exact reason when a number fails and a flag for duplicates.

It runs on Google's open-source phone metadata (the `libphonenumber` rules) **completely offline**: no API keys, no third-party calls, no personal data leaves the run. 100,000 numbers are processed in seconds of compute.

### Why use it

- **Fix messy lists before you import them** into a CRM, dialer, SMS tool or database: one consistent E.164 column.
- **Format-level validation across 240+ countries and regions**, using each country's numbering plan (length and prefix rules).
- **Line type** (`MOBILE`, `FIXED_LINE`, `FIXED_LINE_OR_MOBILE`, `TOLL_FREE`, `VOIP`, `PREMIUM_RATE`, `PERSONAL_NUMBER`...) where the numbering plan distinguishes them.
- **Clear failure reasons**: `TOO_SHORT`, `TOO_LONG`, `INVALID_COUNTRY`, `NOT_A_NUMBER`, `INVALID_LENGTH`, `INVALID_NUMBER`.
- **Local numbers made easy**: set a default country (e.g. `VN`) and `0912345678` becomes `+84912345678`.
- **Extensions** (`ext. 45`, `x45`) are parsed into their own field.
- **Duplicate flagging**: different notations of the same number (`0912 345 678` vs `+84 912 345 678`) are detected.
- **One row per input**, same order as your list, so it is easy to join back to your spreadsheet.

### What it does NOT do

This is a **numbering-plan check, not a live check**. It tells you a number is well-formed and plausible for its country. It does **not** tell you whether the number is currently connected, who owns it, which carrier it is on, whether it has WhatsApp/Telegram, or whether it is on a do-not-call list. `type` comes from numbering-plan ranges; for some countries (e.g. the US) mobile and landline share ranges and the result is `FIXED_LINE_OR_MOBILE`, and numbers that were ported between carriers or types cannot be detected offline.

### Input

| Field | Description |
|---|---|
| `phoneNumbers` | List of numbers, one per item. |
| `textBlob` | Optional pasted text/CSV, one number per line. For CSV/TSV lines the first cell containing a digit is used. |
| `skipFirstLine` | Ignore the first line of `textBlob` (CSV header). |
| `defaultCountry` | ISO-2 code (`US`, `GB`, `VN`, `DE`...) used for numbers without a `+` prefix. |
| `outputFormat` | `all` (default), `e164`, `international`, `national` or `rfc3966`. E.164 is always present. |
| `dedupe` | Flag later duplicates (valid numbers only) in `duplicateOf`. |

Blank lines and empty items are ignored (and never charged).

```json
{ "phoneNumbers": ["0912345678", "+44 20 7946 0958", "12345"], "defaultCountry": "VN", "dedupe": true }
```

### Output (one row per input)

```json
{
  "input": "0912345678",
  "isValid": true,
  "isPossible": true,
  "country": "VN",
  "countryCallingCode": "84",
  "nationalNumber": "912345678",
  "extension": null,
  "type": "MOBILE",
  "E164": "+84912345678",
  "international": "+84 912 345 678",
  "national": "0912 345 678",
  "RFC3966": "tel:+84912345678",
  "reason": null,
  "duplicateOf": null
}
```

An invalid row keeps whatever could be parsed, e.g. `"input": "12345"` with `"isValid": false`, `"reason": "TOO_SHORT"`. Text that is not a number gives `"reason": "NOT_A_NUMBER"` and null formats. A run summary (counts of valid/invalid/duplicates, by line type and country) is saved to the key-value store as `SUMMARY`.

### Pricing

Pay per event: **$0.001 per number validated** ($1 per 1,000; $100 per 100,000). Every non-empty input row is one billable event, valid or invalid — the check itself is the service. Duplicates flagged by `dedupe` are still processed and billed. Set *Max cost per run* to cap spending; the actor stops cleanly when the limit is reached.

### FAQ

**How many numbers can I run at once?** Tested with 100,000 numbers on the default 256 MB memory. Larger lists work in several runs.

**Why does a number I know is real show `isValid: false`?** The numbering plan may not yet cover a recently allocated range, or the number was typed with a wrong digit count. `isPossible` and `reason` show whether the length is at least plausible.

**Why `FIXED_LINE_OR_MOBILE`?** In some countries (US, Canada...) the numbering plan does not separate landlines from mobiles, so offline data cannot tell them apart.

**Do vanity numbers like 1-800-FLOWERS work?** Letters in a valid pattern are converted to digits as the telephone keypad does; random words give `NOT_A_NUMBER`.

**Is any data sent to a third party?** No. Validation uses metadata bundled with the actor.

Data and rules come from the open-source libphonenumber metadata via the `libphonenumber-js` package. The actor does not call any external service or scrape any website.

### Use with AI agents (MCP)

This Actor works as a tool for Claude, ChatGPT, Cursor and other MCP clients through the Apify MCP server:

```
https://mcp.apify.com?tools=beryline_pastel/bulk-phone-number-validator
```

Example prompt: *"Validate this list of phone numbers, convert them to E.164 and mark mobile vs landline."*

### Related tools by the same author

- [Bulk Core Web Vitals Auditor](https://apify.com/beryline_pastel/bulk-core-web-vitals-auditor)
- [Bulk Domain Checker (expiry, WHOIS, DNS, SSL)](https://apify.com/beryline_pastel/bulk-domain-checker)
- [Broken Link & Redirect Checker](https://apify.com/beryline_pastel/broken-link-redirect-checker)
- [Bulk PDF Text Extractor](https://apify.com/beryline_pastel/bulk-pdf-text-extractor)
- [Bulk Email Validator (MX, disposable, typos)](https://apify.com/beryline_pastel/bulk-email-validator-mx-disposable)

# Actor input Schema

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

Phone numbers to validate, one per item. Any common notation works (+84 912 345 678, (202) 555-0123, 0912345678, 020 7946 0958 ext. 12).

## `textBlob` (type: `string`):

Optional text, one number per line. For CSV/TSV lines the first cell containing a digit is used. Blank lines are ignored and not charged.

## `skipFirstLine` (type: `boolean`):

Tick if the pasted CSV starts with a header row such as "phone".

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

2-letter country code (US, GB, VN, DE...) used to interpret numbers without a + prefix. Leave empty if all numbers are international (+...).

## `outputFormat` (type: `string`):

Which formatted versions to include. E.164 is always included for valid-looking numbers.

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

Mark rows whose valid E.164 number (plus extension) already appeared earlier: the duplicateOf field holds the first occurrence. Duplicates are still processed and counted.

## Actor input object example

```json
{
  "phoneNumbers": [
    "+84 912 345 678",
    "(202) 555-0123",
    "+44 20 7946 0958",
    "+49 30 901820",
    "12345"
  ],
  "skipFirstLine": false,
  "defaultCountry": "US",
  "outputFormat": "all",
  "dedupe": false
}
```

# Actor output Schema

## `numbers` (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 = {
    "phoneNumbers": [
        "+84 912 345 678",
        "(202) 555-0123",
        "+44 20 7946 0958",
        "+49 30 901820",
        "12345"
    ],
    "defaultCountry": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("beryline_pastel/bulk-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 = {
    "phoneNumbers": [
        "+84 912 345 678",
        "(202) 555-0123",
        "+44 20 7946 0958",
        "+49 30 901820",
        "12345",
    ],
    "defaultCountry": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("beryline_pastel/bulk-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 '{
  "phoneNumbers": [
    "+84 912 345 678",
    "(202) 555-0123",
    "+44 20 7946 0958",
    "+49 30 901820",
    "12345"
  ],
  "defaultCountry": "US"
}' |
apify call beryline_pastel/bulk-phone-number-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,beryline_pastel/bulk-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/2nDFrb33rsCSm3aah/builds/iwacmWjvC8iSZZZad/openapi.json
