# Phone Number Validator & Formatter (Offline, Bulk) (`mrlarryjohnson/phone-number-validator`) Actor

Validate, normalize and enrich phone numbers in bulk: E.164 / international / national format, valid or possible, line type (mobile, landline, VoIP, toll-free), country, region and time zones. Uses Google's libphonenumber metadata; numbers never leave the run.

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

## Pricing

from $0.50 / 1,000 phone 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 (Offline, Bulk)

Clean up a phone list in one run. Paste numbers in any format and get back the **E.164**, international and national formats, whether each number is **valid** for its country, its **line type** (mobile, landline, VoIP, toll-free, premium), its country, the approximate area, and its **time zones**.

It uses Google's open-source **libphonenumber** metadata and runs fully offline inside the Actor. Numbers aren't sent to any third-party API, and nobody gets called or texted.

### What you can use it for

- Normalize CRM / checkout / signup data to E.164 before importing it into Twilio, HubSpot, Salesforce or a database
- Catch typos and fake numbers ("12345", missing digits) at the form or import stage
- Route by country, or schedule calls inside the right time zone
- Split mobile from landline numbers for SMS-capable lists you already have consent for

### Input

| Field | Default | Notes |
|---|---|---|
| `phoneNumbers` | — | Up to 100,000 strings in any format |
| `defaultCountry` | `US` | Used for numbers without a `+country` prefix |
| `includeCarrier` | `true` | The carrier the range was originally assigned to (number porting means this is a hint, not live HLR) |
| `includeGeo` | `true` | Area description + IANA time zones |
| `deduplicate` | `true` | Each distinct string is processed and charged once |

### Output (one row per number)

```json
{
  "input": "020 7946 0958", "isValid": true, "isPossible": true,
  "e164": "+442079460958", "international": "+44 20 7946 0958", "national": "020 7946 0958",
  "countryCallingCode": 44, "regionCode": "GB", "lineType": "FIXED_LINE",
  "carrier": null, "location": "London", "timeZones": ["Europe/London"], "error": null
}
```

`error` is one of `EMPTY`, `TOO_LONG`, `NOT_A_NUMBER`, `INVALID_COUNTRY_CODE`, `TOO_SHORT_NSN`, `NOT_POSSIBLE` or `INVALID_NUMBER`.

### Pricing (pay per event)

- **$0.50 per 1,000 numbers** (`phone-validated`, $0.0005 each), plus Apify's standard $0.00005 actor start.
- Duplicates are skipped and not charged. If you set a maximum cost for the run, the Actor stops when it's reached.

### Limits and honesty

- "Valid" means the number matches the official numbering plan for that country. It does **not** mean the line is currently active, and no live network lookup (HLR) is done.
- Carrier data is the original allocation, so ported numbers can show their old carrier.

### Responsible use

Only process numbers you're allowed to process (your customers, your leads, with consent). Don't use this for unsolicited calling or texting. Output stays in your own Apify dataset.

***

*Actively maintained. Issues and feature requests are answered within 24 hours on the Issues tab.*

# Actor input Schema

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

Phone numbers in any format ("(415) 555-2671", "+44 20 7946 0958", "0049 30 901820"). One per line. Up to 100,000 per run.

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

Used for numbers written without a +country code, e.g. US, GB, DE, IN, BR.

## `includeCarrier` (type: `boolean`):

Adds the carrier the number range was originally allocated to (mobile numbers only). Numbers may have been ported since, so treat it as a hint.

## `includeGeo` (type: `boolean`):

Adds the approximate area (city/region of the number range) and its time zones.

## `deduplicate` (type: `boolean`):

Process each distinct input string only once (you are only charged once).

## Actor input object example

```json
{
  "phoneNumbers": [
    "+1 (650) 253-0000",
    "020 7946 0958",
    "+49 30 901820",
    "12345"
  ],
  "defaultCountry": "US",
  "includeCarrier": true,
  "includeGeo": true,
  "deduplicate": true
}
```

# 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": [
        "+1 (650) 253-0000",
        "020 7946 0958",
        "+49 30 901820",
        "12345"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mrlarryjohnson/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": [
        "+1 (650) 253-0000",
        "020 7946 0958",
        "+49 30 901820",
        "12345",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("mrlarryjohnson/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": [
    "+1 (650) 253-0000",
    "020 7946 0958",
    "+49 30 901820",
    "12345"
  ]
}' |
apify call mrlarryjohnson/phone-number-validator --silent --output-dataset

```

## MCP server setup

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