# Phone Number Validator & Formatter (Bulk, 240+ Countries) (`squarish_altruism/phone-validator`) Actor

Validate and format phone numbers in bulk: valid or not, country, line type (mobile, landline, VoIP, toll-free), E.164 and local formats, original carrier, area and time zones. Works offline on Google's libphonenumber data: no lookups of who owns a number.

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

## Pricing

$0.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 & Formatter (Bulk, 240+ Countries)

> **At a glance:** check and clean phone numbers offline. **You get** validity, country, line type and standard formats. **Cost:** 1,000 numbers are $0.50, and duplicates are free.

Check and clean phone numbers in bulk. For every number you get **valid or not**, the **country**, the **line type** (mobile, landline, VoIP, toll-free and more), the number in **standard formats**, plus the original carrier, area and time zones where known.

It works **offline on Google's open libphonenumber data**, the same rules Android uses. It does not call anyone, send messages, or look up who owns a number.

### What you get for each number

- **Valid / possible:** whether the number is in a range assigned in its country, and if not, why (too short, too long, unknown range).
- **Formats:** E.164 (`+31612345678`), international (`+31 6 12345678`), national (`06 12345678`) and a `tel:` link.
- **Country** and calling code.
- **Line type:** mobile, landline, landline or mobile, VoIP, toll-free, premium rate, shared cost, pager, voicemail.
- **Original carrier:** the operator the number range was first issued to. Numbers can be moved to another operator, so treat this as a hint.
- **Area:** the city or region for geographic numbers.
- **Time zones** the number can belong to.

### Input

Paste numbers one per line, in any common notation:

```json
{
  "numbers": ["+31 20 624 1111", "0031612345678", "(415) 555-2671", "tel:+442079460958"],
  "defaultCountry": "US"
}
```

- **Default country** is only needed for numbers written without an international prefix, like `(415) 555-2671`.
- **Return valid numbers only** drops invalid and unreadable entries.
- **Remove duplicates** returns each number once, even when it appears in different notations.

### Output

```json
{
  "input": "+31 20 624 1111",
  "valid": true,
  "possible": true,
  "reason": null,
  "e164": "+31206241111",
  "international": "+31 20 624 1111",
  "national": "020 624 1111",
  "rfc3966": "tel:+31206241111",
  "countryCode": "NL",
  "country": "Netherlands",
  "callingCode": "+31",
  "nationalNumber": "206241111",
  "extension": null,
  "type": "landline",
  "isMobile": false,
  "originalCarrier": null,
  "location": "Amsterdam",
  "timezones": ["Europe/Amsterdam"],
  "checkedAt": "2026-11-14T12:00:00.000Z"
}
```

A run summary with totals (valid, invalid, unreadable, duplicates) is saved as `OUTPUT` in the key-value store.

### Pricing

- **$0.0005 per number checked** ($0.50 per 1,000).
- Entries that can't be read as a phone number at all are **free**, and so are duplicates.

### Use cases

- **Clean a CRM or sign-up list:** normalise every number to E.164 and flag the invalid ones.
- **Before an SMS or call campaign to your own customers:** keep mobiles, drop landlines, and group by time zone.
- **Form and import checks:** validate numbers from a spreadsheet before loading them into another system.
- **Data pipelines:** deduplicate contacts that differ only in how the number was typed.

### Use with AI agents (MCP)

This Actor works as a tool for AI assistants such as Claude, ChatGPT and Cursor, through [Apify's MCP server](https://mcp.apify.com).

1. Add the server to your MCP client, with this Actor selected:

```json
{
  "mcpServers": {
    "apify": { "url": "https://mcp.apify.com?tools=squarish_altruism/phone-validator" }
  }
}
```

In Claude Code: `claude mcp add apify "https://mcp.apify.com?tools=squarish_altruism/phone-validator" -t http`

2. Sign in with your Apify account when your client asks. If it can't use OAuth, send your Apify API token in an `Authorization: Bearer` header.
3. Ask in plain language, for example: *"Validate these numbers, convert them to E.164 and tell me which are mobiles: +31 6 12345678, (415) 555-2671 (US)."*

Runs started by an agent are billed to your Apify account at the same prices as above.

### Limitations

- **It checks the numbering plan, not the network.** A valid number may still be switched off or unassigned to a subscriber. Checking that needs a paid network lookup, which this Actor does not do.
- **Carrier is the original one.** Number portability means the current operator can differ.
- **Area and carrier are missing for some ranges,** especially mobiles (no area) and landlines (no carrier).

### Feedback

Found a number that is classified wrongly? Open an issue on the Issues tab with the number's country and type.

### Related tools

- [Bulk Domain Checker](https://apify.com/squarish_altruism/domain-intel)
- [Website SEO Audit & Broken Link Checker](https://apify.com/squarish_altruism/site-audit)

# Actor input Schema

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

One number per line, in any common format: +31 6 12345678, 0031612345678, (415) 555-2671, tel:+442079460958. Numbers without an international prefix need a default country.

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

Two-letter country code (for example NL, US, GB, DE) used for numbers written without an international prefix. Leave empty if every number starts with + or 00.

## `onlyValid` (type: `boolean`):

Leave invalid and unreadable entries out of the results.

## `deduplicate` (type: `boolean`):

Return each number once, even if it appears several times in different formats.

## Actor input object example

```json
{
  "numbers": [
    "+31 20 624 1111",
    "+1 (415) 555-2671",
    "+44 7911 123456"
  ],
  "onlyValid": false,
  "deduplicate": true
}
```

# Actor output Schema

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

One item per phone number.

# 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": [
        "+31 20 624 1111",
        "+1 (415) 555-2671",
        "+44 7911 123456"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("squarish_altruism/phone-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 = { "numbers": [
        "+31 20 624 1111",
        "+1 (415) 555-2671",
        "+44 7911 123456",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("squarish_altruism/phone-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 '{
  "numbers": [
    "+31 20 624 1111",
    "+1 (415) 555-2671",
    "+44 7911 123456"
  ]
}' |
apify call squarish_altruism/phone-validator --silent --output-dataset

```

## MCP server setup

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