# Phone Number Validator: Bulk Format & Type Check (`jackalalpha/phone-validator`) Actor

Validates and formats phone numbers in bulk with offline rules: E.164, national and international formats, country, and line type (mobile, fixed line, toll free, VoIP).

- **URL**: https://apify.com/jackalalpha/phone-validator.md
- **Developed by:** [Jackal Alpha](https://apify.com/jackalalpha) (community)
- **Categories:** Lead generation, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 phone numbers checked

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: E.164 & Line Type

By Jackal Alpha.

This phone number validator checks and formats a list of numbers offline, using Google's public libphonenumber numbering-plan rules, so it is fast and never contacts anyone. For each number you get valid or not, the E.164, international and national formats, country, calling code and line type (mobile, fixed line, toll free, VoIP and more), plus the reason when a number is invalid. Point it at a dataset from another Actor, name the phone field, set a default country, and keep only valid numbers or certain line types. Price: $0.001 per number ($1 per 1,000); duplicates and filtered rows are free. It does not tell you whether a number is in service, who the carrier is today, or whether it is on WhatsApp or Telegram.

**What it does not do:** it does not tell you whether a number is currently in service, who the carrier is today, or whether the number is on WhatsApp or any other app. See "What it does not check" below.

### What it checks

For every number:

- **Validity.** Whether the number matches the numbering-plan rules of its country: right length, valid area or mobile prefix. `valid` is the strict test; `possible` is the looser length-only test.
- **Formats.** E.164 (`+442079460958`), international (`+44 20 7946 0958`) and national (`020 7946 0958`). For invalid numbers these are `null`, because a made-up format would be misleading.
- **Country and calling code.** For example `GB` and `44`. For shared calling codes such as +1 the country is worked out from the area code.
- **Number type.** `mobile`, `fixed_line`, `fixed_line_or_mobile`, `toll_free`, `premium_rate`, `shared_cost`, `voip`, `personal_number`, `pager`, `uan`, `voicemail`, or `null` when the rules cannot tell. US and Canadian numbers are mostly `fixed_line_or_mobile`, because the North American plan does not separate the two.
- **Reason for invalid numbers.** `too_short`, `too_long`, `invalid_length`, `invalid_country` (no `+` and no default country, or an unknown calling code), `not_a_number`, or `invalid_number` (plausible length, but it fails the country's pattern rules).
- **Duplicates.** Numbers are compared by their E.164 form, so `(415) 555-2671` and `+1 415 555 2671` count as the same number. Invalid entries are compared by their text.

### What it does not check

This is an offline rules check. **It does not tell you** whether the number is connected right now, whether it has been disconnected or ported to another carrier, who the carrier is today (the rules only know who the number range was originally given to), whether a mobile is switched on, or whether it is registered on WhatsApp, Telegram or any other service. `valid: true` means the number is correctly formed for its country, not that anyone will answer.

The number-type data is the best the public rules offer and is not complete for every country. Treat `null` as "unknown", not as "not a mobile".

### Input

| Field | Type | Default | Meaning |
|---|---|---|---|
| `numbers` | list of strings | five examples | Numbers to check. |
| `datasetId` | string | none | An existing Apify dataset to read numbers from, in addition to `numbers`. |
| `phoneField` | string | `phone` | Field in that dataset which holds the number. |
| `defaultCountry` | string | none | Two-letter country code (`US`, `GB`, `DE`) for numbers written without `+` and a country code. A number that starts with `+` ignores it. |
| `dedupe` | boolean | `true` | Skip repeats. Skipped repeats are not output and not charged. If off, repeats are checked, marked `isDuplicate` and charged. |
| `onlyValid` | boolean | `false` | Output only valid numbers. Hidden rows are not charged. |
| `onlyTypes` | list | none | Output only these types, for example `mobile`. Invalid numbers and numbers of unknown type are hidden when this is set. Hidden rows are not charged. |

Empty or non-text entries are ignored and not charged. Plain numbers in a dataset (such as `14155552671`) are read as text. If both `numbers` and `datasetId` are empty, the run fails.

### Output

One record per number, in input order:

```json
{
  "input": "(202) 555-0143",
  "valid": true,
  "possible": true,
  "e164": "+12025550143",
  "international": "+1 202 555 0143",
  "national": "(202) 555-0143",
  "country": "US",
  "countryCallingCode": "1",
  "type": "fixed_line_or_mobile",
  "reason": null,
  "isDuplicate": false
}
```

An invalid number looks like this:

```json
{
  "input": "12345",
  "valid": false,
  "possible": false,
  "e164": null,
  "international": null,
  "national": null,
  "country": "US",
  "countryCallingCode": "1",
  "type": null,
  "reason": "too_short",
  "isDuplicate": false
}
```

A `SUMMARY` record in the key-value store holds the counts for the run: delivered, valid, skipped duplicates, hidden by filters, and whether the run stopped at your spending limit.

### Pricing

Pay per event: **$0.001 per number delivered** (event name `phone-validated`), charged once for each result that lands in the dataset. Duplicates that are skipped, empty rows and rows hidden by `onlyValid` or `onlyTypes` are not charged. Apify platform usage is billed separately by Apify as usual, though a run like this uses very little compute.

Worked example: a list of 50,000 rows with 5,000 repeats, keeping only mobile numbers. Say 30,000 of the remaining 45,000 are mobile. You are charged for the 30,000 delivered: 30,000 x $0.001 = **$30.00**.

If you set a maximum cost per run, the Actor charges in batches of 1,000 before delivering them and stops when the limit is reached. You are never given results beyond what the limit pays for. The run's status message says when it stopped at your limit, and `SUMMARY` lists the rest as `notDelivered`.

### Limits and performance

- Checking is local CPU work with no network calls, so thousands of numbers take well under a second of compute. A 10,000-number run finishes in seconds, mostly spent writing the dataset.
- Numbers are held in memory for the run, so lists of a few million are fine on the default memory setting.
- The rules data comes from the `libphonenumber-js` package and is updated when this Actor is rebuilt, not live.

### FAQ

**Can I tell if a number is a real, working line?** No. Only a live lookup against carrier data or a call can, and this Actor deliberately does neither.

**Why is my US number `fixed_line_or_mobile`?** The North American numbering plan does not mark which numbers are mobile, so the rules cannot say. The type is `null` when they cannot tell at all.

**Why is a number I know is real marked invalid?** New ranges are released often. If a carrier launched a prefix after the rules were last updated, it will fail until the Actor is rebuilt. `possible: true` with `valid: false` often points to this.

**Why `invalid_country`?** The number had no `+` and no `defaultCountry` was set, or its calling code does not exist. Set `defaultCountry` or write the numbers with a `+`.

**Is the sample data real?** No. The sample numbers come from ranges set aside for documentation and drama use, or are public business-style test numbers.

# Actor input Schema

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

Numbers to check, one per line (up to 100,000 per run, list and dataset together). You can also use Bulk edit to paste a whole list. Numbers without a leading + need a default country.

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

ID or name of an existing Apify dataset to read numbers from, in addition to the list above. The list and the dataset together may hold at most 100,000 numbers.

## `phoneField` (type: `string`):

Name of the dataset field that holds the number. Only used with a dataset ID.

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

Two-letter country code (for example US, GB, DE) used for numbers written without a + and country code. Leave empty if all numbers start with +.

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

Skip numbers that repeat an earlier one (compared by E.164 form, so '(415) 555-2671' and '+14155552671' match). Skipped duplicates are not output and not charged. If off, they are checked, marked isDuplicate and charged.

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

Output only numbers that pass validation. Hidden rows are not charged.

## `onlyTypes` (type: `array`):

Keep only numbers of the chosen types, for example mobile. Numbers whose type cannot be told, and invalid numbers, are hidden when this is set. Hidden rows are not charged.

## Actor input object example

```json
{
  "numbers": [
    "+44 20 7946 0958",
    "(202) 555-0143",
    "+61 491 570 156",
    "+1 800 555 0100",
    "12345"
  ],
  "phoneField": "phone",
  "defaultCountry": "US",
  "dedupe": true,
  "onlyValid": false
}
```

# 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 = {
    "numbers": [
        "+44 20 7946 0958",
        "(202) 555-0143",
        "+61 491 570 156",
        "+1 800 555 0100",
        "12345"
    ],
    "phoneField": "phone",
    "defaultCountry": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jackalalpha/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 = {
    "numbers": [
        "+44 20 7946 0958",
        "(202) 555-0143",
        "+61 491 570 156",
        "+1 800 555 0100",
        "12345",
    ],
    "phoneField": "phone",
    "defaultCountry": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("jackalalpha/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 '{
  "numbers": [
    "+44 20 7946 0958",
    "(202) 555-0143",
    "+61 491 570 156",
    "+1 800 555 0100",
    "12345"
  ],
  "phoneField": "phone",
  "defaultCountry": "US"
}' |
apify call jackalalpha/phone-validator --silent --output-dataset

```

## MCP server setup

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