# Phone Number Validator & E.164 Formatter (Offline) (`bardach_technologies/offline-phone-number-validator-and-formatter`) Actor

Validate and format up to 10,000 phone numbers worldwide: E.164, international or national, with region, line type and time zones. Offline, from Google's libphonenumber rules: no live carrier or reachability lookup. 'Valid' means the number matches the numbering plan.

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

## Pricing

from $1.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 & E.164 Formatter** checks a list of phone numbers from any country and writes each one in a clean, consistent format: **E.164** (`+16502530000`), international or national. Paste up to 10,000 numbers; get one row per number, in the same order, with its status (valid, invalid or unparsed), the reason when it is not valid, its country and region, its **line type** (mobile, fixed line, toll free ...) where the numbering-plan rules know it, its time zones, and all three formats. It runs **offline** on Google's libphonenumber rules (the open-source `phonenumbers` port), so numbers are never sent to a lookup service.

**This Actor checks validity and format only.** It does **no live carrier or reachability lookup**: there is no carrier lookup, no live line check and no network call while it runs. "Valid" means the number matches the numbering plan: it is well formed and falls in a range that the numbering plan assigns. It does not mean the line is active, reachable or owned by anyone. If you need to know the current carrier, whether a line is live, or who owns it, this is the wrong tool.

### How to validate and format phone numbers in bulk

1. Paste the numbers into **Phone numbers**, one per line, as you have them (`+44 20 7946 0958`, `(202) 555-0123`, `0049 30 123456` ...).
2. Set **Default region** (US, GB, DE ...) for numbers written without a `+` country code.
3. Pick the format for the `formatted` column: E.164, international or national.
4. Click **Start**. Download the result as CSV, Excel or JSON, or read it through the Apify API.

### What it does

1. Reads your numbers (text, so a leading `+` or `0` is kept) and the optional default region.
2. Parses each number with the open-source `phonenumbers` library (a Python port of Google's libphonenumber metadata). Everything runs inside the Actor from rules shipped with the library, so a run makes no request to any other service.
3. Writes one row per input number to the output dataset, in input order.
4. Saves a summary to the key-value store record `OUTPUT`: how the run ended, counts of valid, invalid and unparsed numbers, rows charged, and the version of the `phonenumbers` library used.

### Input

| Field | What it does |
|---|---|
| `numbers` | The numbers to check, as text. Up to 10,000 per run, each at most 100 characters. The console form is prefilled with seven test numbers (see below); an empty list means the run ends at once, writes a zero summary and charges nothing except Apify's own start fee. |
| `defaultRegion` | Two-letter region code (US, GB, DE ...) used for numbers written without a `+` country code. Optional (prefilled with `US`). Without it, a number that has no `+` is `unparsed` with reason `MISSING_REGION`. |
| `format` | `e164` (default), `international` or `national`: which form goes in the `formatted` field. All three forms are always given in their own fields. |

Any other input field is refused, and a number that is not a string is refused, before anything is written or charged.

The form (and Apify's daily test run) starts with this prefilled example, so a first run shows a few rows: five valid numbers from five countries in different spellings, one invalid, one that is not a number. They are public test numbers only: the UK, US, French and Australian regulators' fictional drama ranges and the library's own German example. Six of the seven are billable numbers: about USD 0.009 for the run.

```json
{
  "numbers": ["+44 20 7946 0958", "(202) 555-0123", "+33 1 99 00 12 34", "+61 491 570 006", "+49 30 123456", "12345", "call me"],
  "defaultRegion": "US",
  "format": "e164"
}
```

### Output

One row per number, in input order.

| Field | Meaning |
|---|---|
| `input` | The text you gave. |
| `status` | `valid`, `invalid` or `unparsed` (see below). |
| `valid` / `possible` | `valid`: well formed and in an assigned range for its region. `possible`: the length fits the region's rules. |
| `reason` | Why it is not valid, otherwise null. Invalid numbers: `TOO_SHORT`, `TOO_LONG`, `INVALID_LENGTH`, `INVALID_COUNTRY_CODE` or `NOT_A_VALID_NUMBER` (the length fits but the number is not in an assigned range). Unparsed text: `NOT_A_NUMBER`, `MISSING_REGION`, `INVALID_COUNTRY_CODE`, `TOO_SHORT_AFTER_IDD`, `TOO_SHORT_NSN` or `TOO_LONG`. |
| `countryCode` | The calling code (1, 44 ...), when it could be read. |
| `regionCode` | The region the number belongs to (valid numbers only). |
| `numberType` | `MOBILE`, `FIXED_LINE`, `FIXED_LINE_OR_MOBILE`, `TOLL_FREE`, `PREMIUM_RATE`, `VOIP` and so on, where the library's rules know it, `UNKNOWN` otherwise (valid numbers only). This is the type the numbering plan assigns to the range, not a live check. |
| `extension` | An extension written after the number (`ext 55`), if any. |
| `timezones` | Time zones for the number's area, where the rules know them. |
| `e164`, `international`, `national`, `formatted` | The number in each form, and in the form you chose. Only filled for valid numbers: an invalid number is not given a made-up clean form. |

Status in plain words:

- `valid`: a real, assigned number pattern. Charged.
- `invalid`: the text was read as a number but it is not valid (too short, too long, unassigned range). Charged: you get an answer.
- `unparsed`: the text could not be read as a phone number at all (letters, empty, no country code and no default region, or characters that cannot be stored as text, which are shown as `\udXXX` escapes). **Not charged.**

Country-specific details (for example whether a given mobile range is already assigned) depend on the metadata of the pinned library version. They can lag a recent change by a numbering authority.

### How a run ends

Every run ends in exactly one of three ways, named the same in the status message, the `OUTPUT` record (`outcome`) and here.

| Outcome | What it means | Exit status |
|---|---|---|
| `complete` | Every number was checked, written and (where billable) charged. | success |
| `stoppedEarly` | Your maximum charge was reached. The rows written are a correct start of the result in input order and every billable row among them was charged (unparsed rows are free); the rest was not checked. Start a new run with a higher maximum charge to get everything (it writes into its own dataset, so you pay for those rows again). | success (your own limit) |
| `incomplete` | A resume was refused because the output could not be proven consistent (see Limits). The message says what is already written and charged. | **failed** |

Automations should read `outcome` in `OUTPUT`: a succeeded run can be `stoppedEarly`. A run that fails on bad input (`Input problem: ...`) writes no `OUTPUT`.

### Pricing

Pay per event, no subscription. Apify platform usage is not billed on top. **How much does it cost?** 1,000 numbers cost USD 1.50; the seven-number example in the form costs about USD 0.009.

The events:

| Event | Price | When |
|---|---|---|
| `apify-actor-start` | USD 0.00005 | Charged by Apify once at the start of every run, including runs that end at once or fail on bad input. |
| `number-checked` | **USD 0.0015** per number (USD 1.50 per 1,000) | One number that was read as a phone number and answered valid or invalid, charged right after its row is written. |

Text that cannot be read as a number at all (`unparsed`) is written but not charged. A number listed twice is checked and charged twice. Empty input charges nothing but Apify's start fee. The Actor never charges for a row it did not write. A maximum charge is respected exactly: no billable row beyond what your maximum charge pays for is written. Rows are written and charged one page of up to 500 rows at a time. Platform compute costs of the run are not part of what you pay beyond these events.

### Limits

- **Validity, not liveness.** No carrier, no portability, no line status, no owner. See the top of this page.
- **Up to 10,000 numbers per run.** Split larger lists across runs. There is no file or URL input in this version.
- **Resuming and charging.** If a run is moved to another server or restarted, it reads the output dataset back (re-reading while the platform's read lags behind what the run saved, up to ten times a few seconds apart), checks that it holds exactly the rows this input produces, and continues after the last row. No row is written twice and none is charged twice. A crash between writing a page and charging it can leave up to one page of 500 rows written but not charged (you are under-charged, never over-charged). If the output still cannot be proven consistent after those reads (rows missing, rows that do not match, more charged than written) the resume is refused: the run fails as `incomplete`, tells you how many rows were written and how many were charged, and you start a new run.
- **Speed and memory.** Measured on the Apify platform on 2026-11-18 (256 MB, 10,000 mixed numbers, default region US, `e164`, pages of 500 rows): 9.4 seconds of run time, peak memory 54 MB, 10,000 rows in input order. A Linux container limited to 256 MB on a laptop took 18.9 seconds and peaked at 75 MB. Your numbers will differ. Charging under real pay-per-event pricing was not measured on the platform (the platform measurement above ran while the listing was still free).
- **Library and numbering-plan data.** Uses `phonenumbers` 9.0.43 (pinned), released 2026-11-06, licensed Apache-2.0. All numbering-plan data (ranges, formats, line types, time zones) is the data shipped in that release, so a change a numbering authority made after 2026-11-06 may not be known yet. The `OUTPUT` summary records the version and its release date (`phonenumbersVersion`, `phonenumbersReleased`). **Update policy:** the library is re-pinned to its newest release and the Actor rebuilt at least quarterly; the Actor's test suite fails when the pinned release is more than 120 days old. The Actor's own code is not a copy of the library.

### Use cases

- Clean a contact export before an import: normalise every number to E.164 and drop the ones that cannot be valid.
- Find typos in a form or CRM export: the `reason` column says whether a number is too short or too long.
- Sort a list by line type (mobile or fixed) or by region before a campaign you are allowed to run.

### FAQ

#### Does it check whether a number is active or who owns it?

No. It checks validity and format only, with no carrier lookup and no live line check (see the top of this page).

#### Which countries are supported?

Every country and region in Google's libphonenumber metadata, in the pinned release named under Limits.

#### Can I use it in my own code or an AI agent?

Yes: through the Apify API, a client library (Python, JavaScript), an integration (Make, Zapier, n8n) or the Apify MCP server, with the input shown above.

#### Related Actors from the same developer

**Dataset Merge & Deduplicate** merges your Apify datasets and removes duplicate rows by one or more fields, for example by the `e164` number this Actor writes.

# Actor input Schema

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

The numbers to check, as text so a leading + or 0 is kept. Up to 10,000 per run, each at most 100 characters. A number without a + country code is read in the default region. Each parsed number is priced at USD 0.0015 (USD 1.50 per 1,000), checked and charged separately, so a number listed twice is charged twice. Text that cannot be read as a phone number at all is written as 'unparsed' and is not charged.

## `defaultRegion` (type: `string`):

Two-letter region code such as US, GB or DE, used for numbers written without a + country code. Leave empty if every number starts with + (numbers without it are then reported as 'unparsed', reason MISSING_REGION, and are not charged).

## `format` (type: `string`):

Which form goes in the 'formatted' field of valid numbers. All three forms are always given in their own fields.

## Actor input object example

```json
{
  "numbers": [
    "+44 20 7946 0958",
    "(202) 555-0123",
    "+33 1 99 00 12 34",
    "+61 491 570 006",
    "+49 30 123456",
    "12345",
    "call me"
  ],
  "defaultRegion": "US",
  "format": "e164"
}
```

# Actor output Schema

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

One row per input number, in input order.

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

How the run ended (complete, stoppedEarly or incomplete) with counts of valid, invalid and unparsed numbers and the rows charged.

# 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-0123",
        "+33 1 99 00 12 34",
        "+61 491 570 006",
        "+49 30 123456",
        "12345",
        "call me"
    ],
    "defaultRegion": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("bardach_technologies/offline-phone-number-validator-and-formatter").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-0123",
        "+33 1 99 00 12 34",
        "+61 491 570 006",
        "+49 30 123456",
        "12345",
        "call me",
    ],
    "defaultRegion": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("bardach_technologies/offline-phone-number-validator-and-formatter").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-0123",
    "+33 1 99 00 12 34",
    "+61 491 570 006",
    "+49 30 123456",
    "12345",
    "call me"
  ],
  "defaultRegion": "US"
}' |
apify call bardach_technologies/offline-phone-number-validator-and-formatter --silent --output-dataset

```

## MCP server setup

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

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/YE85sagBZfnFdMgOb/builds/X6oTdTeVIMiGRLMb4/openapi.json
