# Phone Number Validator & E.164 Normalizer (Asia-ready) (`arched_axolotl/phone-number-validator-e164`) Actor

Validate phone numbers from any country and normalise them to E.164, with line type, region, carrier and time zone. Handles messy Asian lists: full-width digits, 分機 extensions, lost leading zeros, country codes without a plus. Offline and fast. For list cleaning, AI agents and n8n.

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Normalizer (Asia-ready)

Check phone numbers from any country and get each one back in E.164 format, together with its line type (mobile, fixed line, toll-free …), country, area, original carrier and time zone.

It is rule-based and works offline, using the numbering-plan data of Google's libphonenumber. No number is called, texted or looked up anywhere, a run takes about a second, and the same input always gives the same answer.

It was built for the messy numbers found in Asian contact lists: full-width digits, `分機` / `内線` / `내선` extensions, leading zeros eaten by spreadsheets, country codes typed without a plus, two numbers in one cell.

驗證各國電話號碼並統一為 E.164 格式，輸出號碼類型（手機／市話／免付費）、國家、地區、電信業者與時區；支援全形數字、「分機」、被 Excel 吃掉的開頭 0、沒有加號的國碼等常見髒資料。純規則運算、不撥號、不連網。

### What you can do with it

- **Clean a contact list** before importing it into a CRM, an SMS tool or WhatsApp/LINE messaging.
- **Normalise to E.164** so the same person is not stored three times as `0912-345-678`, `+886 912 345 678` and `886912345678`.
- **Separate mobile from fixed-line numbers** before an SMS campaign.
- **Find broken numbers**: too short, too long, impossible prefix, missing area code.
- **Give an AI agent an exact check** instead of letting it guess whether a number "looks valid".

### Input

Only `values` is needed, plus `defaultCountry` when the numbers are in local format.

| Field | Type | Default | What it does |
|---|---|---|---|
| `values` | array of strings | — | The numbers to check, written any way. |
| `defaultCountry` | string | none | Country assumed for numbers without a country code: ISO code (`TW`), calling code (`+886`) or name (`Taiwan`, `台灣`, `日本`). Numbers starting with `+` ignore it. |
| `records` | array of objects | — | Rows of a list, as an alternative to `values`. Other columns are passed through. |
| `valueField` | string | guessed | Field of each record that holds the number. |
| `countryField` | string | — | Field of each record that holds that row's country; overrides `defaultCountry` for the row. |

#### Example: a Taiwanese list with a few foreign numbers

```json
{
    "values": ["0912-345-678", "(02)8101-8800 分機 123", "＋８１ ３－３２１１－１１１１", "886912345678", "+1 650 253 0000"],
    "defaultCountry": "TW"
}
```

#### Example: rows with their own country column

```json
{
    "records": [
        { "name": "Tanaka", "tel": "090-1234-5678", "country": "日本" },
        { "name": "Chan", "tel": "9123 4567 / 2345 6789", "country": "HK" }
    ],
    "valueField": "tel",
    "countryField": "country"
}
```

### What input it understands

| Input | Result |
|---|---|
| `0912-345-678`, `0912 345 678`, `0912345678` (default TW) | `+886912345678` |
| `０９１２　３４５　６７８` (full-width) | `+886912345678` |
| `912345678` (leading zero lost in Excel, default TW) | `+886912345678` |
| `+886 0912345678`, `+886 (0)912 345 678` (trunk zero kept) | `+886912345678` |
| `886912345678` (country code without `+`) | `+886912345678`, warning `assumed_country_code` when no default country matched |
| `00886912345678`, `002-886-912-345-678` (international dialling prefix) | `+886912345678` |
| `電話：(02) 8101-8800`, `TEL: 03-5636688` (labels) | label ignored |
| `(02)8101-8800 分機 123`, `…轉123`, `…#123`, `… ext 123`, `内線 45`, `내선 7` | number plus `extension` |
| `9123 4567 / 2345 6789`, `…、…` (two numbers in one cell) | first number validated, the rest in `additionalNumbers` |

### Output

One item per input value, in the same order. Nothing is dropped: empty and unreadable values come back as invalid with a reason.

A valid number (from a real run):

```json
{
    "index": 1,
    "input": "(02)8101-8800 分機 123",
    "isValid": true,
    "isPossible": true,
    "e164": "+886281018800",
    "international": "+886 2 8101 8800#123",
    "national": "02 8101 8800#123",
    "rfc3966": "tel:+886-2-8101-8800;ext=123",
    "countryCallingCode": 886,
    "region": "TW",
    "regionName": "Taiwan",
    "numberType": "fixed_line",
    "location": "Taipei",
    "carrier": null,
    "timeZones": ["Asia/Taipei"],
    "extension": "123",
    "reason": null,
    "message": null,
    "warnings": [],
    "additionalNumbers": []
}
```

An invalid number (from the same run):

```json
{
    "index": 6,
    "input": "0912-345-67",
    "isValid": false,
    "isPossible": true,
    "e164": null,
    "international": null,
    "national": null,
    "rfc3966": null,
    "countryCallingCode": 886,
    "region": "TW",
    "regionName": null,
    "numberType": null,
    "location": null,
    "carrier": null,
    "timeZones": [],
    "extension": null,
    "reason": "invalid_for_region",
    "message": "The length is plausible, but the digits match no number range in region TW. A digit may be wrong or the area code missing.",
    "warnings": [],
    "additionalNumbers": []
}
```

With `records`, each item also has `record`, the original row unchanged.

#### Fields

| Field | Meaning |
|---|---|
| `input` | The value exactly as you sent it. |
| `isValid` | `true` when the number fits a real number range of its country. |
| `isPossible` | `true` when at least the length is plausible. Useful to tell a typo from garbage. |
| `e164` | Canonical form for storage, matching and APIs: `+886912345678`. Never includes the extension. `null` when invalid. |
| `international`, `national` | Human-readable forms, as printed in that country. |
| `rfc3966` | `tel:` link form, including the extension. |
| `countryCallingCode`, `region`, `regionName` | `886`, `TW`, `Taiwan`. |
| `numberType` | `mobile`, `fixed_line`, `fixed_line_or_mobile`, `toll_free`, `premium_rate`, `shared_cost`, `voip`, `personal_number`, `pager`, `uan`, `voicemail` or `unknown`. |
| `location` | Area of a fixed-line number (for example `Taipei`, `Tokyo`), otherwise the country. |
| `carrier` | Operator the mobile range was originally assigned to. See the limits below. |
| `timeZones` | Time zones the number can be in. |
| `extension` | Extension digits, if any. |
| `reason`, `message` | Machine-readable code and short explanation when invalid, otherwise `null`. |
| `warnings` | What was assumed or repaired (see below). |
| `additionalNumbers` | Further numbers found in the same value, not validated. |

#### Reason codes

| `reason` | Meaning |
|---|---|
| `empty` | Nothing to check. |
| `not_a_number` | The value has no digits or is not shaped like a phone number. |
| `country_required` | Local format and no `defaultCountry` (or country column) to interpret it. |
| `invalid_country_code` | The calling code after `+` does not exist. |
| `too_short`, `too_long` | Too few or too many digits for that country. |
| `invalid_length` | The number of digits fits no number type in that country. |
| `invalid_for_region` | Plausible length, but no number range in that country matches. Usually a wrong digit or a missing area code. |
| `missing_area_code` | A local number that can only be dialled inside its area. |

#### Warnings

| `warnings` entry | Meaning |
|---|---|
| `assumed_country_code` | The digits had no `+` but form a valid international number, so a `+` was assumed. |
| `assumed_international_prefix` | A leading `00` was read as the international dialling prefix. |
| `multiple_numbers` | The value held several numbers; only the first was validated. |
| `numeric_input` | The value arrived as a JSON number, so a leading `0` or `+` may already have been lost. |
| `region_differs_from_default` | A local-format number turned out to belong to another country sharing the calling code (for example Canada with default `US`). |
| `unknown_country_hint` | The record's country field was not recognised; `defaultCountry` was used. |

#### Summary

Every run also saves a summary to the `OUTPUT` record of its key-value store:

```json
{
    "total": 9,
    "valid": 8,
    "invalid": 1,
    "validPercent": 88.9,
    "invalidByReason": { "invalid_for_region": 1 },
    "validByRegion": { "TW": 3, "JP": 2, "US": 1, "KR": 1, "HK": 1 },
    "validByNumberType": { "mobile": 5, "fixed_line": 2, "fixed_line_or_mobile": 1 },
    "warnings": { "multiple_numbers": 1 },
    "stoppedAtItemLimit": false,
    "defaultCountry": "TW"
}
```

### Use with AI agents (MCP)

The Actor works as a tool for Claude, ChatGPT, Cursor and other MCP clients through the [Apify MCP server](https://mcp.apify.com). Add it with this server URL:

```
https://mcp.apify.com?tools=arched_axolotl/phone-number-validator-e164
```

Then ask in plain language, for example: *"Normalise these Taiwanese customer phone numbers to E.164 and tell me which are mobile."*

Input that works well for agents:

```json
{
    "values": ["0912-345-678", "(02)8101-8800 分機 123"],
    "defaultCountry": "TW"
}
```

Tips for agents: pass the values exactly as found. Set `defaultCountry` whenever the numbers are not all in `+` format. Read `isValid`, `e164`, `numberType`, `reason` and `message`.

### Use with n8n

In **n8n**, add the **Apify** node, choose **Run an Actor and get dataset**, pick this Actor and paste the input JSON. Each checked number arrives as one n8n item.

A typical workflow:

1. **Google Sheets / Airtable / CRM** — read the contacts.
2. **Apify** — run this Actor with `records` set to the rows, `valueField` set to the phone column, and `defaultCountry`.
3. **IF** — `isValid` is true and `numberType` is `mobile`.
4. **Update row / SMS node** — write `e164` back, or send the message. Route the invalid rows, with `record`, `reason` and `message`, to a review sheet.

Because the original row comes back in `record`, you do not need a merge step.

From any tool that can call a URL:

```bash
curl -X POST "https://api.apify.com/v2/acts/arched_axolotl~phone-number-validator-e164/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"values": ["0912-345-678", "+81 3-3211-1111"], "defaultCountry": "TW"}'
```

This call waits for the run and returns the results as JSON in one response.

### Limits to know about

- **Valid does not mean in service.** The check tells you that the number belongs to a range that the country has assigned. It cannot tell whether that particular number is connected, who owns it, or whether it is on WhatsApp or LINE. That needs a live network lookup, which this Actor does not do.
- **`carrier` is the original operator of the number range.** People keep their numbers when they change operator, so the current operator can differ. In countries with shared ranges it is empty.
- **`fixed_line_or_mobile`.** In some countries (the United States and Canada among them) the number alone does not reveal the line type.
- **Numbering plans change.** Results reflect the libphonenumber data bundled at build time. Very new number ranges may be reported as invalid until the Actor is rebuilt.
- **Local numbers need a country.** `0912345678` could be Taiwanese or Vietnamese. Without `defaultCountry` or a country column the result is `country_required`, not a guess.
- **Digits without `+` are read as international only when that gives a valid number**, and the result carries the `assumed_country_code` warning. Check those rows if your list mixes countries.
- **One number per value.** If a cell holds several numbers, the first is validated and the rest are returned unvalidated in `additionalNumbers`.
- Location and country names are in English. Up to 200,000 values per run.

### FAQ

**How fast is it?** The checks take milliseconds; a run is mostly container start-up, about a second or two in total.

**Does it call or text the numbers?** No. There are no network calls of any kind.

**Which countries are supported?** Every country and territory in libphonenumber, about 245. The extra input handling (full-width characters, Chinese, Japanese and Korean extension words and labels) is aimed at Asian lists.

**Why is a number I know is real reported invalid?** Most often the default country is wrong or an area code is missing. If the number is from a newly opened range, the bundled numbering data may be older than the range.

**What does it do with extensions?** The extension is returned in `extension` and inside `rfc3966`, `international` and `national`. `e164` never contains it, so it is safe to use as a key.

**Is the data personal?** Phone numbers of people are personal data. The Actor processes only what you send, stores results in your own Apify run storage under your account's retention settings, and sends nothing anywhere else.

# Actor input Schema

## `values` (type: `array`):

Phone numbers, one per item, written any way: '+886 912 345 678', '0912-345-678', '(02)8101-8800 分機 123', full-width digits, with labels such as 'TEL:' or '電話'. Numbers that start with '+' are understood on their own; numbers in local format need 'defaultCountry'. Pass the values as found, without cleaning them first.

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

Country assumed for numbers written without a country code, as a two-letter ISO code (TW, JP, KR, CN, HK, SG, MY, TH, VN, ID, PH, IN, AU, US, GB, ...), a calling code ('+886') or a name ('Taiwan', '台灣', '日本'). Numbers that start with '+' ignore it. Leave empty only when every number is in international format; local numbers then come back with reason 'country_required'.

## `records` (type: `array`):

Alternative to 'values' for cleaning a whole list: an array of JSON objects, one per row, for example \[{"name": "Amy", "phone": "0912-345-678"}]. The number is read from the field named in 'valueField'. Every row comes back in the same order with the validation result, and the original row is returned unchanged in the 'record' field.

## `valueField` (type: `string`):

Name of the field in each record that contains the phone number, for example 'phone' or '電話'. Required with 'records' unless the field is called phone, phoneNumber, phone_number, tel, telephone, mobile, cell, value, number, 電話, 手機, 聯絡電話 or 電話番号.

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

Optional. Name of a field in each record that contains that row's country (ISO code, calling code or name). It replaces 'defaultCountry' for that row. Rows where it is empty or not recognised fall back to 'defaultCountry'.

## Actor input object example

```json
{
  "values": [
    "0912-345-678",
    "(02)8101-8800 分機 123",
    "＋８１ ３－３２１１－１１１１",
    "886912345678",
    "+1 650 253 0000",
    "+82 10-1234-5678",
    "0912-345-67"
  ],
  "defaultCountry": "TW"
}
```

# Actor output Schema

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

One item per input value, in input order, with validity, E.164 form, region and line type.

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

Run summary: counts of valid and invalid numbers by region and by reason.

# 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 = {
    "values": [
        "0912-345-678",
        "(02)8101-8800 分機 123",
        "＋８１ ３－３２１１－１１１１",
        "886912345678",
        "+1 650 253 0000",
        "+82 10-1234-5678",
        "0912-345-67"
    ],
    "defaultCountry": "TW"
};

// Run the Actor and wait for it to finish
const run = await client.actor("arched_axolotl/phone-number-validator-e164").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 = {
    "values": [
        "0912-345-678",
        "(02)8101-8800 分機 123",
        "＋８１ ３－３２１１－１１１１",
        "886912345678",
        "+1 650 253 0000",
        "+82 10-1234-5678",
        "0912-345-67",
    ],
    "defaultCountry": "TW",
}

# Run the Actor and wait for it to finish
run = client.actor("arched_axolotl/phone-number-validator-e164").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 '{
  "values": [
    "0912-345-678",
    "(02)8101-8800 分機 123",
    "＋８１ ３－３２１１－１１１１",
    "886912345678",
    "+1 650 253 0000",
    "+82 10-1234-5678",
    "0912-345-67"
  ],
  "defaultCountry": "TW"
}' |
apify call arched_axolotl/phone-number-validator-e164 --silent --output-dataset

```

## MCP server setup

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

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/iaWjkuumdMkVmYZ2z/builds/dVfGlkdSW8ykqWOBP/openapi.json
