# Bulk Phone Number Validator & E.164 Formatter (`forlab/phone-number-validator`) Actor

Validate phone numbers in bulk and format them to E.164 for CRM imports. Get country, line type, original carrier, prefix location and time zones when available. Uses Google libphonenumber numbering-plan data. $0.50 per 1,000 checks plus $0.001 per run.

- **URL**: https://apify.com/forlab/phone-number-validator.md
- **Developed by:** [ForLab Digital](https://apify.com/forlab) (community)
- **Categories:** Lead generation, Developer tools, Marketing
- **Features:** 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 checks

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

## Bulk Phone Number Validator & E.164 Formatter

Clean up phone numbers before a CRM import, standardize an exported contact list or classify numbers by line type. Paste a batch of local and international numbers. Each answered check reports whether the number matches its numbering plan. Valid numbers include **E.164**, national and international formats, the country and line type, plus the original carrier, prefix location and IANA time zones where available.

The checks use Google libphonenumber metadata. An Apify account is enough to run the Actor.

### Task examples

Paste one complete JSON input into the **Input** tab. Each item takes a `number` string (up to 40 characters) and an optional two-letter `country` to interpret local numbers.

#### Normalize a CRM phone list to E.164

Use `data.e164` as the canonical phone field and `index` to join results to the original rows. An answered number that fails validation has `data.valid: false`.

```json
{"items":[{"number":"+1 415 555 2671"},{"number":"12"}]}
```

#### Validate local UK numbers with a default country

Supply `country: GB` for a UK local number. This example returns `+442079460958`, line type `fixed_line` and the prefix location London.

```json
{"items":[{"number":"020 7946 0958","country":"GB"}]}
```

#### Find line type and original carrier for a Turkish mobile

This example returns `mobile` and the original allocation to Turkcell.

```json
{"items":[{"number":"0532 123 45 67","country":"TR"}]}
```

### Example output

Each item yields one dataset row. Sort by `index` to restore input order. Here is the row for the Turkish mobile example:

```json
{
  "index": 0,
  "input": {"number":"0532 123 45 67","country":"TR"},
  "status": "ok",
  "data": {
    "valid": true,
    "possible": true,
    "e164": "+905321234567",
    "national": "0532 123 45 67",
    "international": "+90 532 123 45 67",
    "country": "TR",
    "type": "mobile",
    "carrier": "Turkcell",
    "location": "Turkey",
    "timezones": ["Europe/Istanbul"]
  }
}
```

- `index` and `input` identify the original item.
- `status` is `ok` for an answered check, even when `data.valid` is false. `invalid` (bad input), `failed` and `skipped` rows carry a `code` and have no lookup charge.
- `data.valid` checks the numbering plan. `data.possible` checks whether the length is plausible. Unparseable numbers include a `data.reason`: `invalid_country`, `too_short`, `too_long` or `not_a_number`.
- For valid numbers, `data.e164`, `data.national` and `data.international` hold the formatted numbers. `data.country` holds the two-letter country code when available.
- `data.type` is one of `mobile`, `fixed_line`, `fixed_line_or_mobile`, `toll_free`, `premium_rate`, `shared_cost`, `voip`, `personal_number`, `pager`, `uan`, `voicemail` or `unknown`.
- `data.carrier` is the original carrier and `data.location` the area or country associated with the prefix. Either can be null. `data.timezones` lists IANA zone IDs and can be empty.

The run's `OUTPUT` record summarizes statuses and charges.

### Pricing

| Event | Price |
| --- | --- |
| Phone number check | $0.50 per 1,000 answered checks |
| Actor start | $0.001 per run |

An answered check is charged whether the number is valid or invalid under its numbering plan. Invalid input items, failures and skipped items are free. The Actor charges phone checks after saving results. Send up to 5,000 numbers per run. On the Apify free plan, the Actor processes up to 1,000 numbers per run.

### Try it before you buy

Try a phone check for free without a key in the [Geo API docs](https://api.forlab.io/docs/geo). See [service status](https://status.forlab.io) or email <api@forlab.io> for a higher-volume key.

### Frequently asked questions

#### What does a valid phone number mean?

Its length and prefix match the numbering plan. The Actor does not check live assignment, reachability, SMS delivery or the owner's identity.

#### Does the carrier reflect number portability?

The carrier shows the original allocation of the number range. It can be empty, for example for a landline. Prefix location and time zones describe geography associated with that range. A mobile prefix can have several time zones.

#### Can I tell mobile from landline?

Use `data.type`. Some numbering plans share ranges for mobile and landline numbers. These can return `fixed_line_or_mobile`.

### Run it from code

```bash
curl -X POST "https://api.apify.com/v2/acts/forlab~phone-number-validator/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"number":"+1 415 555 2671"},{"number":"020 7946 0958","country":"GB"}]}'
```

# Actor input Schema

## `operation` (type: `string`):

The one operation this Actor runs: every item is one phone number to validate and format. You can leave it out of the input.

## `items` (type: `array`):

1–5,000 objects (1,000 on the Apify free plan), one number each: number (required; spaces, dashes, brackets and a leading + are allowed) and country (optional two-letter code, the default country for numbers written without +). Every row keeps its item under input with the zero-based index; rows come out in completion order, so sort by index if you need the input order. An item with another field or an empty number is invalid and not charged.

## Actor input object example

```json
{
  "operation": "phone",
  "items": [
    {
      "number": "+1 415 555 2671"
    },
    {
      "number": "+44 20 7946 0958"
    },
    {
      "number": "030 901820",
      "country": "DE"
    },
    {
      "number": "0532 123 45 67",
      "country": "TR"
    },
    {
      "number": "+49 123"
    }
  ]
}
```

# Actor output Schema

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

One item per input number: the input under input with its index, a status (ok, invalid, failed or skipped) and for answered numbers the data: valid, possible, and for valid numbers e164, national, international, country, type, carrier, timezones and location; reason when the number cannot be parsed.

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

Counts per status and per charged event, why items were skipped, and the data's attribution.

# 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 = {
    "items": [
        {
            "number": "+1 415 555 2671"
        },
        {
            "number": "+44 20 7946 0958"
        },
        {
            "number": "030 901820",
            "country": "DE"
        },
        {
            "number": "0532 123 45 67",
            "country": "TR"
        },
        {
            "number": "+49 123"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("forlab/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 = { "items": [
        { "number": "+1 415 555 2671" },
        { "number": "+44 20 7946 0958" },
        {
            "number": "030 901820",
            "country": "DE",
        },
        {
            "number": "0532 123 45 67",
            "country": "TR",
        },
        { "number": "+49 123" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("forlab/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 '{
  "items": [
    {
      "number": "+1 415 555 2671"
    },
    {
      "number": "+44 20 7946 0958"
    },
    {
      "number": "030 901820",
      "country": "DE"
    },
    {
      "number": "0532 123 45 67",
      "country": "TR"
    },
    {
      "number": "+49 123"
    }
  ]
}' |
apify call forlab/phone-number-validator --silent --output-dataset

```

## MCP server setup

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