# Phone Number Validator (`pontio/validate-phone`) Actor

Validity, line type, region, carrier, timezones and every standard format for a phone number. Fully offline.

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

## Pricing

$2.00 / 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.

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

Validate up to 1,000 phone numbers in one run and get each number's line type, region, carrier, timezones and every standard format, with no network lookup and no per-number upstream fee.

### What you get

One dataset item per number you send. Here is one of them, for input `+1 415-555-2671`:

```json
{
  "input": "+1 415-555-2671",
  "valid": true,
  "possible": true,
  "e164": "+14155552671",
  "formats": {
    "international": "+1 415 555 2671",
    "national": "(415) 555-2671",
    "rfc3966": "tel:+14155552671"
  },
  "region": "US",
  "regionName": "United States",
  "countryCode": 1,
  "type": "fixed_line_or_mobile",
  "carrier": null,
  "carrierConfidence": null,
  "timezones": ["America/Los_Angeles"],
  "reasonCode": "valid"
}
```

### Use it when

- You are cleaning a lead or contact list before it gets dialed, texted, or loaded into a CRM.
- You need one canonical form of a number (E.164) for deduplication or storage.
- You are routing by line type, and want to skip premium-rate or toll-free numbers before you pay to send anything.
- You are scheduling calls and need the number's timezones.
- An agent is validating a list and needs a stable, typed answer per row.

### Input

| Field | Type | Required | What it does |
| --- | --- | --- | --- |
| `phones` | array of strings | yes | The raw numbers in any common format, up to 1,000 per run. A `tel:` prefix is accepted. Each distinct number gets one dataset item and one charge. The same digits written differently (`+1 (415) 555-2671`, `tel:+14155552671`) count once. |
| `defaultRegion` | ISO-3166 alpha-2 string | no | The country assumed for numbers with no leading `+`, for example `US`. Ignored for numbers already in E.164 form. Case does not matter. |

`defaultRegion` is a run-wide setting: it applies to every number in the batch, not to one of them. A list pasted out of a CRM is usually all from one country, which is the case it serves. If yours is not, split the numbers across runs.

A number written without a `+` and without a `defaultRegion` cannot be resolved to any country, so it comes back as `ambiguous_no_region` rather than a guess.

A number written with a leading `00` is treated the same way unless `00` is the international prefix of the `defaultRegion`. In much of the world `00` means "dial international". Elsewhere it is part of the number: the NANP dials `011` for international, and Russia dialled `810`. So `0044 7400 123456` is answered under `GB`, and under `US` it comes back `ambiguous_idd_prefix`, free of charge. Guessing would invent a country code. Calling it invalid would delete a real number from your list.

### Output

| Field | What it means |
| --- | --- |
| `valid` | The number fits the numbering plan of its region. |
| `possible` | The length is plausible for the region, a weaker check than `valid`. |
| `e164`, `formats` | Canonical forms. All `null` unless the number is valid, so an invalid number never produces a dialable-looking string. |
| `region`, `regionName`, `countryCode` | ISO country, English country name, calling code. |
| `type` | `mobile`, `fixed_line`, `fixed_line_or_mobile`, `voip`, `toll_free`, `premium_rate`, `shared_cost`, `pager`, `personal_number`, `uan`, or `unknown`. |
| `carrier`, `carrierConfidence` | The carrier the number block was allocated to. `carrierConfidence` is always `prefix-based` when a carrier is present. |
| `timezones` | IANA timezone names for the number's area. |
| `reasonCode` | `valid`, `invalid_length`, `invalid_country_code`, `not_assigned`, `impossible`, `not_a_number`, `ambiguous_no_region`, `ambiguous_idd_prefix`, or `unknown_region`. |

### Pricing

Pay per event, $2.00 per 1,000 validated numbers ($0.002 each), charged on the `phone-validated` event.

A number that comes back conclusively invalid is charged like a valid one, because a list-cleaning job is buying both answers. A non-answer is never charged:

| `reasonCode` | Charged |
| --- | --- |
| `valid`, `invalid_length`, `invalid_country_code`, `not_assigned`, `impossible` | yes |
| `not_a_number` (input is not a number at all) | no |
| `ambiguous_no_region` (no `+`, no `defaultRegion`) | no |
| `ambiguous_idd_prefix` (leading `00` that this region doesn't dial international with) | no |
| `unknown_region` (`defaultRegion` is not a real country code, and the number needed it) | no |

If you set a maximum total charge for a run, the Actor stops as soon as that limit is reached instead of working for free. Items after that point are left out of the dataset and not charged, and the run log says how many; submit them in a new run.

### What this does not do

`valid` means the number conforms to its country's numbering plan. It does not mean somebody answers it. Nothing here dials, rings, or sends anything.

Carrier comes from the number block's allocation, so a ported number reports the carrier that originally held the block. Line type is `unknown` for countries whose numbering plan does not separate mobile from fixed line.

There is no lookup of a subscriber name, and no HLR query.

### How it works

The Actor bundles Google's libphonenumber metadata, with the full range data rather than the trimmed set, plus its offline carrier and timezone data files. It makes no network requests at all, so there is nothing to rate limit and no upstream that can be down.

### One verdict per number

Numbers are validated in the order you send them, each written as its own dataset item. There is no start fee, so a list of 1,000 numbers pays one container start for the whole run instead of one per number:

```js
const run = await client.actor('pontio/validate-phone').call({
  phones: ['+1 415-555-2671', '(415) 555-2671'],
  defaultRegion: 'US',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

If you set a maximum charge for the run and the batch reaches it, the run stops there rather than carrying on with work it cannot charge for. A run that reaches its timeout stops the same way. Either way the items already written stay in the dataset, and each names what it answers, so you can re-run the remainder.

# Actor input Schema

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

ISO-3166 alpha-2 region assumed when phone has no leading '+' (e.g. US). Ignored for numbers already in E.164 form.

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

Raw phone numbers to validate, e.g. +1 415-555-2671 (max 1000 per run). One verdict and one charge per distinct number; the same digits formatted differently count once.

## Actor input object example

```json
{}
```

# Actor output Schema

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

One item per input, in this run's default dataset.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("pontio/validate-phone").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("pontio/validate-phone").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 '{}' |
apify call pontio/validate-phone --silent --output-dataset

```

## MCP server setup

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

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/5AmwsAkRHNlKbUUj5/builds/tGetNoFMSa69t5ug9/openapi.json
