# Phone Number Validator — Bulk Format, Country & Line Type (`openregistry/phone-number-validator`) Actor

Validate and format thousands of phone numbers: valid or not and why, E.164, international and national formats, country, mobile vs landline vs VoIP vs toll-free. 240+ countries, Google libphonenumber metadata, works offline — no number is sent anywhere. Pay per number.

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

## Pricing

$0.50 / 1,000 number checkeds

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 — bulk format, country & line type

Clean a list of phone numbers in seconds. For every number you get: **valid or not, and why**, the **E.164** format
(`+33612345678`) your CRM, SMS or dialer tools expect, international and national display formats, the **country**,
and the **line type**: mobile, landline, VoIP, toll-free, premium rate, shared cost…

**$0.50 per 1,000 numbers.** Fast (tens of thousands per minute), offline, nothing to configure.

### Why use it

- **Before an SMS or WhatsApp campaign**: keep mobile numbers only, drop the invalid ones.
- **CRM and spreadsheet clean-up**: one consistent E.164 format instead of `06 12…`, `(202) 555…`, `0044 20…`.
- **Lead forms**: catch fake or mistyped numbers.
- **Country routing**: know which country each number belongs to.

### Private and offline

Validation uses Google's libphonenumber metadata (via `libphonenumber-js`, full "max" metadata, 240+ countries and
territories) **inside the Actor**. Numbers are not sent to any third-party API and nothing is called on the phone
network.

What it does not do: tell you whether a number is currently connected or who owns it (that needs a paid carrier
lookup). "Valid" means the number exists in the country's official numbering plan.

### Input

| Field | What it does |
|---|---|
| `phoneNumbers` / `phonesText` | Numbers in any format; `00` prefixes are understood |
| `defaultCountry` | ISO code for numbers without `+code` (e.g. `US`, `GB`, `FR`) |
| `validOnly`, `mobileOnly` | Filters (filtered-out numbers are not charged) |
| `maxResults` | Stops the run, so you control the cost |

```json
{ "phoneNumbers": ["06 12 34 56 78", "+1 (202) 555-0143"], "defaultCountry": "FR" }
```

### Output

| Field | Example |
|---|---|
| `input` | 06 12 34 56 78 |
| `valid`, `possible`, `reason` | true, true, null — or false, "invalid length for this country" |
| `e164`, `international`, `national`, `uri` | +33612345678, +33 6 12 34 56 78, 06 12 34 56 78, tel:+33612345678 |
| `country`, `countryCallingCode`, `nationalNumber` | FR, +33, 612345678 |
| `type` | `mobile`, `fixed_line`, `fixed_line_or_mobile`, `voip`, `toll_free`, `premium_rate`, `shared_cost`… |
| `extension` | when the number has one |

### Pricing

Pay per event: **$0.0005 per number** returned. Numbers removed by `validOnly` or `mobileOnly` are not charged.

# Actor input Schema

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

One number per entry, in any format. Numbers without a +country code use the default country below.

## `phonesText` (type: `string`):

Numbers separated by new lines, commas or semicolons (paste a spreadsheet column).

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

Two-letter code used for numbers written without +country code, e.g. US, GB, FR, DE, IN.

## `validOnly` (type: `boolean`):

Skip invalid numbers entirely (they are then neither returned nor charged).

## `mobileOnly` (type: `boolean`):

Keep only numbers whose plan says mobile (or fixed-or-mobile in countries like the US where both share ranges).

## `maxResults` (type: `integer`):

The run stops after this many numbers, so you control the cost.

## Actor input object example

```json
{
  "phoneNumbers": [
    "+33 6 12 34 56 78",
    "(202) 555-0143",
    "0044 20 7946 0958"
  ],
  "defaultCountry": "US",
  "validOnly": false,
  "mobileOnly": false,
  "maxResults": 100000
}
```

# Actor output Schema

## `results` (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": [
        "+33 6 12 34 56 78",
        "(202) 555-0143",
        "0044 20 7946 0958"
    ],
    "defaultCountry": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("openregistry/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": [
        "+33 6 12 34 56 78",
        "(202) 555-0143",
        "0044 20 7946 0958",
    ],
    "defaultCountry": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("openregistry/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": [
    "+33 6 12 34 56 78",
    "(202) 555-0143",
    "0044 20 7946 0958"
  ],
  "defaultCountry": "US"
}' |
apify call openregistry/phone-number-validator --silent --output-dataset

```

## MCP server setup

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