# Phone Number Validator & Formatter — E.164, Type, Carrier (`tidydata/phone-number-validator`) Actor

Validate and format phone numbers in bulk with Google's libphonenumber: valid or not, E.164, international and national format, country, mobile or landline, carrier, time zone and WhatsApp link. Works on pasted lists, CSV files or straight on your scraper's dataset.

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

## Pricing

from $0.56 / 1,000 phone 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 — E.164, Type, Carrier

Validate and clean **phone numbers in bulk** with Google's **libphonenumber** — the same library Android and Gmail use. For every number you get: **valid or not and why**, **E.164**, international and national format, **country**, **mobile / landline / toll-free / VoIP**, original **carrier**, **city or region**, **time zone** and a ready **WhatsApp link**.

Works on a **pasted list**, on **CSV / JSON / TXT files**, or **directly on your scraper's dataset** (Google Maps, Yellow Pages, LinkedIn, lead lists…): every row is kept and enriched with `phone_e164`, `phone_valid`, `phone_type`…

**$0.70 per 1,000 numbers.** Rows without a phone and duplicates are free.

- ✅ **Any format in**: `+1 202-456-1111`, `(415) 555-2671`, `0049 30 901820`, `011 44 20 7946 0958`, `Tel: +44 20 7946 0958 / mobile …`
- ✅ **Finds numbers inside text** (several per cell)
- ✅ **Uses each row's country** (`countryCode`, `country`, `address.countryCode`…) for numbers written without +code — perfect for Google Maps results from many countries
- ✅ **E.164** (`+12024561111`) ready for CRMs, SMS and WhatsApp APIs, plus international, national and `tel:` formats
- ✅ **Line type**: MOBILE, FIXED_LINE, FIXED_LINE_OR_MOBILE, TOLL_FREE, PREMIUM_RATE, VOIP, SHARED_COST, PERSONAL_NUMBER, PAGER, UAN, VOICEMAIL
- ✅ **Why it's invalid**: `too_short`, `too_long`, `invalid_country_code`, `local_only_add_area_code`, `not_assigned_in_this_country`
- ✅ **Removes duplicates** written in different ways
- ✅ **Fast and private**: everything runs inside the Actor — no third-party API, nothing is sent anywhere, no phone calls or SMS

### Who uses it

- **Lead generation** — clean the phones from Google Maps / directory scrapers before importing them to a CRM or dialer.
- **Sales & marketing** — keep only mobiles for SMS or WhatsApp campaigns, normalise everything to E.164.
- **Data teams** — standardise messy phone columns from forms, spreadsheets and exports.
- **E-commerce & logistics** — check customer phone numbers per country before shipping.

### How to use it

**A. Paste numbers** in *Phone numbers* (one per line) and set a *Default country* for numbers without `+code`.

**B. Validate a scraper's results**: pick the dataset in *Or validate the phones in datasets*. The phone column is detected automatically (`phone`, `phoneNumber`, `telephone`, `mobile`, `contact.phone`…) or write it in *Phone fields*.

**C. Run it automatically after your scraper**: add this Actor as an **integration** of your scraper run and set *datasets* to `{{resource.defaultDatasetId}}`. Every run comes out with clean phones.

### Output

List input (one row per number):

```json
{
  "input": "+34 612 34 56 78",
  "valid": true,
  "reason": "ok",
  "e164": "+34612345678",
  "international": "+34 612 34 56 78",
  "national": "612 34 56 78",
  "rfc3966": "tel:+34-612-34-56-78",
  "countryCallingCode": 34,
  "country": "ES",
  "countryName": "Spain",
  "type": "MOBILE",
  "carrier": "Syma",
  "location": "Spain",
  "timeZones": ["Atlantic/Canary", "Europe/Madrid"],
  "extension": null,
  "whatsappUrl": "https://wa.me/34612345678"
}
```

Dataset input: your original row plus `<field>_valid`, `_reason`, `_e164`, `_international`, `_national`, `_country`, `_countryName`, `_type`, `_carrier`, `_location`, `_whatsappUrl` (and `_allE164` when a cell holds several numbers):

```json
{
  "title": "Le Bistro",
  "phone": "01 42 68 53 00",
  "countryCode": "FR",
  "phone_valid": true,
  "phone_e164": "+33142685300",
  "phone_countryName": "France",
  "phone_type": "FIXED_LINE",
  "phone_location": "Paris"
}
```

Export to **CSV, Excel, JSON** or send to Google Sheets, HubSpot, Make, Zapier or n8n with Apify integrations. To merge several runs and drop duplicates, use our [Merge, Deduplicate & Export Datasets](https://apify.com/tidydata/merge-dedupe-datasets) Actor.

### Pricing

**$0.0007 per phone number checked ($0.70 per 1,000).**

| Numbers | Price |
|---|---|
| 1,000 | $0.70 |
| 10,000 | $7 |
| 100,000 | $70 |

Free: rows without a phone, duplicates and invalid input. Higher Apify plans get an automatic discount. Set a **maximum cost per run** and the Actor stops cleanly at that amount.

### FAQ

**Does it tell me if the number is active / in use right now?**
No. It checks that the number is **valid for its country** (right length and an assigned range) and what kind of line it is. Checking if a line is live needs a paid carrier lookup (HLR) per number, which is why those services cost 10–50× more.

**Is the carrier the current one?**
It's the carrier the number range was **originally assigned to**; with number portability the customer may have moved. Carriers are mostly known for mobiles.

**What does FIXED_LINE_OR_MOBILE mean?**
In the US, Canada and a few other countries mobiles and landlines share the same ranges, so they can't be told apart from the number alone.

**Why is my number "local_only_add_area_code"?**
It's a local number without the area code (e.g. `555 1234`). Add the area code.

**Which countries are supported?**
All of them — every country and territory in libphonenumber (250+).

**Is my data safe?**
Numbers are processed inside the Actor run in your Apify account. Nothing is sent to other services.

**Something doesn't work?**
Open an issue in the **Issues** tab with an example number — we answer fast.

# Actor input Schema

## `phones` (type: `array`):

One per line, in any format: +1 202-456-1111, (415) 555-2671, 0049 30 901820, or text that contains numbers.

## `datasetIds` (type: `array`):

Pick datasets from your storages (e.g. a Google Maps or lead scraper run). Every row is kept and enriched with phone_e164, phone_valid, phone_type… When this Actor runs as an integration, use {{resource.defaultDatasetId}}.

## `fileUrls` (type: `array`):

Public links to .csv, .json or plain .txt files (one number per line).

## `phoneFields` (type: `array`):

For datasets and files: the column(s) with phone numbers, e.g. phone or contact.phone. Leave empty to detect them automatically.

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

2-letter code used for numbers written without international prefix, e.g. US, GB, ES, DE, FR, MX, BR, IN. Numbers with + or 00 are detected automatically.

## `useRowCountry` (type: `boolean`):

For datasets and files: if a row has a country code (countryCode, country, address.countryCode…, as Google Maps results do), numbers without +code are read in that country.

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

Finds every phone number inside longer text (e.g. 'Call us: +1 202 456 1111 or 202 456 1414').

## `removeDuplicates` (type: `boolean`):

The same number written in different ways counts once (compared in E.164). Duplicates are free.

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

Keep only valid numbers (for datasets: only rows with at least one valid phone).

## `language` (type: `string`):

e.g. en, es, de, fr, pt.

## `maxRows` (type: `integer`):

Safety limit of input rows to read.

## Actor input object example

```json
{
  "phones": [
    "+1 202-456-1111",
    "(415) 555-2671",
    "+44 20 7946 0958",
    "+34 612 34 56 78"
  ],
  "defaultCountry": "",
  "useRowCountry": true,
  "extractFromText": true,
  "removeDuplicates": true,
  "onlyValid": false,
  "language": "en",
  "maxRows": 1000000
}
```

# Actor output Schema

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

One row per number (or your enriched rows).

# 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 = {
    "phones": [
        "+1 202-456-1111",
        "(415) 555-2671",
        "+44 20 7946 0958",
        "+34 612 34 56 78"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidydata/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 = { "phones": [
        "+1 202-456-1111",
        "(415) 555-2671",
        "+44 20 7946 0958",
        "+34 612 34 56 78",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("tidydata/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 '{
  "phones": [
    "+1 202-456-1111",
    "(415) 555-2671",
    "+44 20 7946 0958",
    "+34 612 34 56 78"
  ]
}' |
apify call tidydata/phone-number-validator --silent --output-dataset

```

## MCP server setup

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