# Phone Number Validator, Formatter & Extractor (E.164, Bulk) (`geeky_goth_gamer/phone-number-validator-extractor`) Actor

Validate and format phone numbers in bulk for 240+ countries (offline, Google libphonenumber), or extract phone numbers from text. Input: numbers or text. Output: valid/invalid with reason, E.164, mobile or landline, carrier, location, time zone. $1.50 per 1,000 valid.

- **URL**: https://apify.com/geeky_goth_gamer/phone-number-validator-extractor.md
- **Developed by:** [Chris Day](https://apify.com/geeky_goth_gamer) (community)
- **Categories:** Lead generation, Developer tools, Business
- **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 valid phone numbers

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 & Extractor (bulk, offline)

Clean up phone lists in bulk with **Google's libphonenumber**, the same library Android uses. It covers 245 countries and regions. Everything runs inside the Actor: there are no third-party APIs, no lookups that send your data elsewhere, and no API keys.

### When an AI agent should use this

Use `geeky_goth_gamer/phone-number-validator-extractor` when:

- You need to check whether phone numbers are valid before sending SMS, calling or importing into a CRM.
- You need phone numbers in a standard format (E.164 such as +61412345678) or want to know mobile vs landline.
- You need to pull phone numbers out of emails, web pages or notes (`mode: "extract"`).

Don't use it for:

- Checking whether a line is currently connected or who owns it (no live HLR lookup).

**Example input:**

```json
{
  "phones": [
    "0412 345 678",
    "(03) 6331 2345",
    "+1 650 253 0000"
  ],
  "defaultCountry": "AU"
}
```

**Output:** One dataset item per number: `valid`, `invalidReason`, `e164`, `national`, `international`, `numberType`, `carrier`, `location`, `timeZones`, `duplicateOf`.

**Cost:** $0.0015 per valid unique number, $0.0003 per invalid one. Repeats and empty rows are free.

**Call it from an agent:**

- Apify MCP server: add `https://mcp.apify.com/?tools=geeky_goth_gamer/phone-number-validator-extractor` to your MCP client; the tool is `geeky_goth_gamer--phone-number-validator-extractor`. Or use `call-actor` with `"actor": "geeky_goth_gamer/phone-number-validator-extractor"`.
- Python: `ApifyClient(token).actor("geeky_goth_gamer/phone-number-validator-extractor").call(run_input=...)`, then read `client.dataset(run["defaultDatasetId"]).list_items().items`.
- HTTP: `POST https://api.apify.com/v2/acts/geeky_goth_gamer~phone-number-validator-extractor/run-sync-get-dataset-items?token=YOUR_TOKEN` with the input JSON as the body.

### Two modes

- **validate:** each item is one phone number. You get whether it is valid, the reason if it is not, and the formats below.
- **extract:** each item is free text (an email, a web page, notes, a CRM field). Every valid phone number found is returned with its position in the text.

### What you get for each number

| Field | Example |
|---|---|
| `valid`, `possible` | `true`, `true` |
| `invalidReason` / `invalidReasonText` | `TOO_SHORT` / "Too short to be a phone number." |
| `e164` | `+61412345678`, ready for SMS and calling APIs |
| `national`, `international`, `rfc3966` | `0412 345 678`, `+61 412 345 678`, `tel:+61-412-345-678` |
| `numberType` | `MOBILE`, `FIXED_LINE`, `TOLL_FREE`, `SHARED_COST`, `VOIP`, … |
| `regionCode`, `countryCallingCode` | `AU`, `61` |
| `location` | `Australia`, or a city or state where libphonenumber has one (mostly landlines) |
| `carrier` | `Telstra` (the network the number range was **originally** allocated to) |
| `timeZones` | `["Australia/Sydney"]` (libphonenumber's zones for the number range; these can be broad, e.g. a Tasmanian landline reports Sydney time) |
| `extension` | `99` |
| `duplicateOf` | the row number of the first time this number appeared in the run |

### Input

- `phones` or `texts`: up to 50,000 items, as strings or `{"id": "your-ref", "value": "..."}`.
- `bulkText`: optional; paste one item per line.
- `defaultCountry` (default `AU`): used for numbers written without `+`. Leave it empty to accept international numbers only.
- `flagDuplicates` (default on).
- `onlyValid` (default off).
- `language`: the language for location and carrier names.

### Fair pricing

- **Valid number:** $0.0015 ($1.50 per 1,000), once per unique number per run.
- **Invalid number:** $0.0003 ($0.30 per 1,000), with the reason it failed.
- **Free:** repeats of a number already seen in the same run, rejected items (empty or not text), and extract-mode texts with no number in them.

Your maximum cost per run is respected.

### Things to know

- **The default country matters.** With `defaultCountry: AU`, the NZ mobile `021 123 4567` reads as a valid Sydney landline (+61 2 1123 4567). Store numbers in `+64…` form, or run each country's list separately.
- **The carrier is the original allocation.** In AU and NZ, numbers can be ported to another network. For the current carrier you need a paid live lookup (HLR), which this Actor does not do.
- **"Valid" means the number is in a range assigned by the country's numbering plan.** It does not mean the line is connected right now.
- Metadata comes from libphonenumber 9.0.44 (bundled with the build).

# Actor input Schema

## `mode` (type: `string`):

"validate" (default): each item in phones is one phone number to check and format. "extract": each item in texts is free text (email, web page, notes) and every phone number found in it is returned.

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

Used by mode "validate". Up to 50,000 phone numbers per run, e.g. \["0412 345 678", "+64 21 123 4567"]. Each item is a string or {"id": "your-ref", "value": "..."}.

## `texts` (type: `array`):

Used by mode "extract". Up to 50,000 texts of up to 20,000 characters each, as strings or {"id": "...", "value": "..."} objects.

## `bulkText` (type: `string`):

Optional. One phone number (or text) per line, added after the list above.

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

Two-letter country code (AU, NZ, US, GB...) used for numbers written without a +country code. Leave empty to accept only international (+) numbers.

## `language` (type: `string`):

Language code for location and carrier names, e.g. "en" (default), "de", "fr".

## `flagDuplicates` (type: `boolean`):

Mark numbers that already appeared earlier in this run ("duplicateOf" points to the first row). Duplicates are never charged.

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

Leave invalid numbers and rejected items out of the results (they are still counted in the status message).

## Actor input object example

```json
{
  "mode": "validate",
  "phones": [
    "0412 345 678",
    "(03) 6331 2345",
    "+64 21 123 4567",
    "+1 650 253 0000"
  ],
  "defaultCountry": "AU",
  "language": "en",
  "flagDuplicates": true,
  "onlyValid": false
}
```

# Actor output Schema

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

No description

# 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 = {
    "phones": [
        "0412 345 678",
        "(03) 6331 2345",
        "+64 21 123 4567",
        "+1 650 253 0000"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("geeky_goth_gamer/phone-number-validator-extractor").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 = { "phones": [
        "0412 345 678",
        "(03) 6331 2345",
        "+64 21 123 4567",
        "+1 650 253 0000",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("geeky_goth_gamer/phone-number-validator-extractor").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 '{
  "phones": [
    "0412 345 678",
    "(03) 6331 2345",
    "+64 21 123 4567",
    "+1 650 253 0000"
  ]
}' |
apify call geeky_goth_gamer/phone-number-validator-extractor --silent --output-dataset

```

## MCP server setup

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

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/MM4D723grfhMDSYHc/builds/diTUGJ9Jp3BGfZcdw/openapi.json
