# Phone Number Validator & Formatter: Bulk E.164, Line Type (`lyfe_tools/phone-number-validator-offline`) Actor

Phone number validator in bulk, offline: format, country and line type (mobile, landline, VoIP, toll-free) to E.164, with duplicate detection. No WhatsApp lookups, no external services.

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

## Pricing

from $0.28 / 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.
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: Bulk E.164, Line Type

Bulk phone number validator and formatter: converts each number to E.164, finds its country and line type
(mobile, landline, VoIP, toll-free), flags duplicates, and gives a reason for every number that fails. It decides
from **numbering plans**, offline, not from calling anyone or looking anything up.

### One list, before and after

Real output of a local run, default country `NL`, one row given its country (`DE`) explicitly:

| Input | E.164 | Country | Type / reason | |
|---|---|---|---|---|
| `+31 6 12345678` | +31612345678 | NL | MOBILE | |
| `06-12345678` | +31612345678 | NL | MOBILE | duplicate of row 0 |
| `(0)20 794 0800` | +31207940800 | NL | FIXED_LINE | |
| `+297 565 1234` | +2975651234 | AW | MOBILE | |
| `+599 9 518 1234` | +59995181234 | CW | MOBILE | |
| `+599 717 8123` | +5997178123 | BQ | FIXED_LINE | |
| `+1 (415) 555-2671` | +14155552671 | US | FIXED_LINE_OR_MOBILE | |
| `+44 20 7946 0958` | +442079460958 | GB | FIXED_LINE | |
| `030 123456789` (row country DE) | +4930123456789 | DE | FIXED_LINE | |
| `+55 11 91234-5678` | +5511912345678 | BR | MOBILE | |
| `+1 800 555 0199` | +18005550199 | US | TOLL_FREE | |
| `call me maybe` | — | — | `NOT_A_NUMBER` | |
| `12345` | — | NL | `NOT_IN_PLAN` | |

14 numbers: 12 valid, 2 invalid, 2 duplicates. The run also writes a `SUMMARY` record with
counts by line type, country and failure reason.

### What it does

- Parses any common way of writing a number: spaces, dashes, brackets, `(0)` trunk digits,
  `00` prefixes, extensions (`ext. 22`).
- Returns `valid`, `possible`, `e164`, `international`, `national`, `country`,
  `countryCallingCode`, `type`, `extension`.
- Line types: `MOBILE`, `FIXED_LINE`, `FIXED_LINE_OR_MOBILE`, `VOIP`, `TOLL_FREE`,
  `PREMIUM_RATE`, `SHARED_COST`, `PERSONAL_NUMBER`, `PAGER`, `UAN`, `VOICEMAIL`, `UNKNOWN`.
- For numbers that fail: `reasonCode` (`NOT_A_NUMBER`, `TOO_SHORT`, `TOO_LONG`, `INVALID_LENGTH`,
  `INVALID_COUNTRY`, `NOT_IN_PLAN`, `EMPTY`) and a plain-language `reason`.
- Flags repeats: a second row with the same E.164 gets `duplicateOf: <row of the first>`.
- Per-row country: give objects a `country` field and national-format numbers are read in
  that country; `defaultCountry` covers the rest.
- Input as a list, as objects (`phoneField`, `countryField`), or as a dataset ID from another Actor.
  Objects keep their original fields under `input`.

Runs entirely offline from the numbering-plan data bundled with the Actor
([libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js), MIT). No external
service, no proxy, nothing that can break because a website changed.

### What it does not do

**It does not tell you whether a number is in use, reachable, or on WhatsApp.** "Valid" means
the number fits the country's numbering plan: right length, a prefix the plan allocates. A
valid number can still be unassigned, disconnected or a fictional range
(`+1 800 555 0199` above passes; it is a film-style number).

- **No carrier or city.** The bundled data does not include carrier or geographic names, so
  those fields are not returned rather than guessed.
- **North America cannot split mobile from landline.** Those numbers come back as
  `FIXED_LINE_OR_MOBILE`, because the plan itself does not distinguish them.
- **Caribbean.** Aruba (+297), Curaçao and Bonaire (+599) are known and validated, and the
  country split works (`CW` vs `BQ`; Sint Maarten resolves to `SX` under +1 721). The line-type
  labels follow the published plans, which lag reality there. Treat `FIXED_LINE` vs `MOBILE` on
  +599 as a hint, not a fact. An old-style `+599 3 123 4567` is reported as `TOO_LONG`.
- **Type is the plan's view.** Number portability and prefix re-use mean the real line type
  can differ.
- Numbers without a `+country` code and with no country given fail with `INVALID_COUNTRY`
  instead of being guessed.

### Input example

```json
{
  "phoneNumbers": [
    "+31 6 12345678",
    "06-12345678",
    "+1 (415) 555-2671",
    { "phone": "030 123456789", "country": "DE" },
    "call me maybe"
  ],
  "defaultCountry": "NL",
  "outputMode": "all"
}
```

Plain strings, or objects with the number in `phoneField` (default `phone`) and an optional two-letter country
in `countryField` (default `country`). `inputDatasetId` reads the rows from another Actor's dataset.

### Output example

One row per number. A real row from a local run of the input above:

```json
{
  "original": "030 123456789",
  "valid": true,
  "possible": true,
  "e164": "+4930123456789",
  "international": "+49 30 123456789",
  "national": "030 123456789",
  "country": "DE",
  "countryCallingCode": 49,
  "type": "FIXED_LINE",
  "extension": null,
  "reason": null,
  "duplicateOf": null,
  "row": 3,
  "input": { "phone": "030 123456789", "country": "DE" }
}
```

| Field | Meaning |
|---|---|
| `original` | The number as submitted |
| `valid` | Fits the country's numbering plan (length and allocated prefix) |
| `possible` | Has a possible length for the country, a weaker test than `valid` |
| `e164` | Normalised `+<country code><number>`, or `null` when it cannot be parsed |
| `international` / `national` | Formatted for display |
| `country` / `countryCallingCode` | ISO country code and calling code |
| `type` | Line type from the plan (`MOBILE`, `FIXED_LINE`, `FIXED_LINE_OR_MOBILE`, `VOIP`, `TOLL_FREE`, ...) |
| `extension` | Extension, if the input had one |
| `reason` / `reasonCode` | Why the number failed (`reasonCode` only on invalid rows) |
| `duplicateOf` | Row index of the first row with the same E.164, or `null` |
| `row` | Position in the input |
| `input` | The original object, for object rows |

The `SUMMARY` record in the key-value store counts valid, invalid and duplicate numbers, by line type, country and
failure reason.

### Price

Price per 1,000 by your Apify plan (Apify applies the right column automatically):

| | Free | Starter | Scale | Business and up |
|---|---|---|---|---|
| Phone number validated, per 1,000 | $0.40 | $0.40 | $0.34 | $0.28 |

No start fee. The figures below use the Free-plan price; on a paid plan the same run costs less.

Pay per event, platform usage included: **$0.0004 per number** (`number-validated`), no start fee.

| Numbers in one run | Cost |
|---|---|
| 1,000 | $0.40 |
| 10,000 | $4.00 |
| 100,000 | $40.00 |

Every non-empty row is billed, including invalid numbers and duplicates, and in both output modes
(`outputMode: "valid-only"` only hides rows). Empty values are skipped and free. A run capped with a maximum charge
processes only as many numbers as the cap affords, and says so in the log.

### Use it from code or an AI agent

```bash
curl -X POST "https://api.apify.com/v2/acts/lyfe_tools~phone-number-validator-offline/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"phoneNumbers": ["+31 6 12345678", "06-12345678"], "defaultCountry": "NL"}'
```

The response is the dataset rows as a JSON array. The Actor also works through the Apify MCP server
(https://mcp.apify.com), so AI agents such as Claude or Cursor can call it as a tool: an agent sends
`phoneNumbers` and `defaultCountry` and reads `valid`, `e164`, `type` and `reason`.

### FAQ

**How do I convert phone numbers to E.164 in bulk?**
Paste them in `phoneNumbers` and set `defaultCountry` for numbers written without `+country`. Each row comes back
with `e164`, `international` and `national`.

**Can it tell mobile from landline?**
Yes, from the numbering plan (`type`), except in North America, where the plan does not separate them and the
answer is `FIXED_LINE_OR_MOBILE`. Ported numbers can differ from the plan.

**Does it check whether a number is active or on WhatsApp?**
No. "Valid" means the number fits the plan, not that it is in use.

**Does it return the carrier or city?**
No; the bundled data has neither, so those fields are left out rather than guessed.

**Does it remove duplicate phone numbers?**
It flags them: a repeat of the same E.164 gets `duplicateOf` pointing at the first row. Filter on
`duplicateOf: null` to keep one of each.

Cleaning an email list as well? See the sibling [Email List Cleaner](https://apify.com/lyfe_tools/email-list-cleaner).

Questions or a number that looks wrong: tools@lyfeoffshore.com.

# Actor input Schema

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

Numbers to validate. Plain strings work. Objects work too: the number is read from the field named in 'Phone field', and an optional 'country' field (two-letter ISO code) tells the validator which country a national-format number belongs to.

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

Two-letter ISO code (NL, US, AW...) used for numbers written without a +country code, such as 06-12345678. A country on the row itself wins over this.

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

For object rows and datasets: the field holding the number.

## `countryField` (type: `string`):

For object rows and datasets: the optional field holding a two-letter country code.

## `inputDatasetId` (type: `string`):

Read the rows from an existing dataset instead of (or as well as) the list above.

## `outputMode` (type: `string`):

You are billed per number checked either way.

## Actor input object example

```json
{
  "phoneNumbers": [
    "+31 6 12345678",
    "06-12345678",
    "+297 565 1234",
    "+599 9 518 1234",
    "+1 (415) 555-2671",
    "+44 20 7946 0958",
    {
      "phone": "030 123456789",
      "country": "DE"
    },
    "+31 6 12345678",
    "call me maybe"
  ],
  "defaultCountry": "NL",
  "phoneField": "phone",
  "countryField": "country",
  "outputMode": "all"
}
```

# Actor output Schema

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

One row per number: valid, E.164, country, line type, reason when invalid, duplicate flag.

## `summary` (type: `string`):

Counts by line type, country, invalid reason and duplicates.

# 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": [
        "+31 6 12345678",
        "06-12345678",
        "+297 565 1234",
        "+599 9 518 1234",
        "+1 (415) 555-2671",
        "+44 20 7946 0958",
        {
            "phone": "030 123456789",
            "country": "DE"
        },
        "+31 6 12345678",
        "call me maybe"
    ],
    "defaultCountry": "NL"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lyfe_tools/phone-number-validator-offline").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": [
        "+31 6 12345678",
        "06-12345678",
        "+297 565 1234",
        "+599 9 518 1234",
        "+1 (415) 555-2671",
        "+44 20 7946 0958",
        {
            "phone": "030 123456789",
            "country": "DE",
        },
        "+31 6 12345678",
        "call me maybe",
    ],
    "defaultCountry": "NL",
}

# Run the Actor and wait for it to finish
run = client.actor("lyfe_tools/phone-number-validator-offline").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": [
    "+31 6 12345678",
    "06-12345678",
    "+297 565 1234",
    "+599 9 518 1234",
    "+1 (415) 555-2671",
    "+44 20 7946 0958",
    {
      "phone": "030 123456789",
      "country": "DE"
    },
    "+31 6 12345678",
    "call me maybe"
  ],
  "defaultCountry": "NL"
}' |
apify call lyfe_tools/phone-number-validator-offline --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lyfe_tools/phone-number-validator-offline"
        }
    }
}
```

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/mtzqLKoukVBKesBHC/builds/Mdp9b2VrPL5E2iM0p/openapi.json
