# Phone Number Validator: US State, Time Zone & Line Type (`waags/us-phone-number-validator`) Actor

Validate and format phone numbers in bulk: E.164, national format, line type (mobile, landline, toll-free), and for US/Canada numbers the state, city, time zone, local time and a TCPA calling-hours check. Works offline, so it is fast and cheap.

- **URL**: https://apify.com/waags/us-phone-number-validator.md
- **Developed by:** [Andres Garcia](https://apify.com/waags) (community)
- **Categories:** Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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: US State, Time Zone & Line Type

**Validate, clean and enrich phone numbers in bulk.** Paste numbers in any format, such as `(512) 474-5171`, `512.474.5171`, `+1 212 736 5000 ext. 12` or `+44 20 7946 0958`, and get back the **E.164 format**, national and international formats, **line type** (mobile, landline, toll-free, premium-rate…), and, for US and Canadian numbers, the **state/province, city, time zone, the recipient's current local time and a TCPA calling-hours check**.

**Works offline** with Google's libphonenumber metadata: no API key, no per-lookup fees, thousands of numbers per second.

### Why this phone validator?

- ☎️ **Any input format:** parentheses, dots, dashes, spaces, `1-` prefixes, `tel:` links and extensions (`ext. 12`, `x12`)
- 🌐 **E.164, national, international and RFC 3966 (`tel:`) formats**, ready for CRMs, dialers, Twilio and SMS tools
- ✅ **Valid / invalid with a reason:** `wrong_length`, `invalid_for_region`, `fictional_555_number`, `not_a_phone_number`
- 🇺🇸 **US & Canada enrichment:** area code, **city-level location** ("Austin, TX"), **state** code and name, **IANA time zone**
- ⏰ **TCPA-friendly calling window:** recipient's **local time** and `isWithinCallingHours` (8 am–9 pm by default, configurable)
- 📞 **Line type:** toll-free, premium-rate, personal numbers, and mobile vs. landline outside the US (US numbers share ranges, so they are reported as `landline_or_mobile`)
- 🧹 **Deduplication** on the normalized number (duplicates are free) and an "only valid" mode
- 🔗 **Chains with other actors:** validate the `phone` field of any Apify dataset by its ID
- 🌍 **International support:** every country's numbering plan, with a configurable default country

### Use cases

- **Sales & call centers:** route leads to reps by time zone and only dial inside legal calling hours
- **CRM & marketing ops:** normalize every number to E.164 before importing into HubSpot, Salesforce, Twilio or SMS platforms
- **Lead generation pipelines:** clean phones from scraped leads (e.g. our [FMCSA trucking leads](https://apify.com/waags/fmcsa-trucking-carrier-leads) or [SEC Form D funding leads](https://apify.com/waags/sec-form-d-funding-leads))
- **Data quality & forms:** catch fake, fictional (555) and malformed numbers
- **Territory analysis:** count leads by state or time zone

### How to use it

1. Click **Try for free**. Sample numbers are prefilled, so the first run works in one click.
2. Paste your numbers (one per line), **or** pick an **Input dataset** (e.g. a lead scraper's output) and set the **Phone field**.
3. Click **Start** and export **CSV, Excel or JSON**, or call it through the [Apify API](https://docs.apify.com/api/v2), Zapier, Make or n8n.

#### Input example

```json
{
    "phoneNumbers": ["(512) 474-5171", "212.736.5000", "1-800-275-2273", "+44 20 7946 0958"],
    "defaultCountry": "US",
    "callingHoursStart": 8,
    "callingHoursEnd": 21,
    "dedupe": true,
    "onlyValid": false
}
```

#### Output example

```json
{
    "input": "(512) 474-5171",
    "isValid": true,
    "isPossible": true,
    "reason": null,
    "e164": "+15124745171",
    "nationalFormat": "(512) 474-5171",
    "internationalFormat": "+1 512 474 5171",
    "rfc3966": "tel:+15124745171",
    "extension": null,
    "countryCode": "US",
    "countryCallingCode": "+1",
    "areaCode": "512",
    "lineType": "landline_or_mobile",
    "isTollFree": false,
    "isMobileCapable": true,
    "location": "Austin, TX",
    "city": "Austin",
    "state": "TX",
    "stateName": "Texas",
    "timeZones": ["America/Chicago"],
    "timeZone": "America/Chicago",
    "localTime": "Thu 11:00",
    "utcOffset": "UTC-5",
    "isWithinCallingHours": true
}
```

### Pricing

Pay-per-event: a tiny start fee plus a fixed price per number saved, currently **about $0.72 per 1,000 numbers** (see the **Pricing** tab). There is no compute charge on top. Duplicates are removed for free, and with **Output only valid numbers** you pay only for valid ones. Cap any run with `maxItems`.

### FAQ

**Does it tell me if a US number is a cell phone?** In North America, mobile and landline numbers share the same number ranges, and numbers can be ported between carriers. No offline database can tell them apart, so US/Canada numbers are reported as `landline_or_mobile` (`isMobileCapable: true`). Toll-free, premium-rate and personal (5XX) numbers are identified exactly. For other countries mobile vs. landline is reported.

**Does it check if the number is in service?** No. There are no network lookups (HLR/CNAM). The actor validates against the official numbering plan, which catches wrong lengths, unassigned area codes, fictional 555 numbers and junk.

**Where do location and time zones come from?** From Google's open-source **libphonenumber** geocoding and time-zone data (Apache 2.0), matched on the area code plus exchange (up to 7 digits) for city-level accuracy. Area codes spanning several time zones return all of them in `timeZones`.

**Is `isWithinCallingHours` legal advice?** No. It is a convenience flag based on the recipient's local time. Always follow the TCPA, state laws and Do-Not-Call rules.

**Questions or bugs?** Use the **Issues** tab. The actor is monitored daily.

### Related actors by WAAGS

- [Bulk Email Validator](https://apify.com/waags/bulk-email-validator): syntax, MX, disposable, role and typo checks
- [FMCSA Trucking Carrier Leads](https://apify.com/waags/fmcsa-trucking-carrier-leads) · [SEC Form D Funding Leads](https://apify.com/waags/sec-form-d-funding-leads) · [SAM.gov Contract Opportunities](https://apify.com/waags/sam-gov-contract-opportunities)

*Location and time-zone data © Google, from libphonenumber, Apache License 2.0.*

# Actor input Schema

## `phoneNumbers` (type: `array`):

Phone numbers in any format, one per line: (512) 555-0199, 512.555.0199, +1 212 736 5000 ext. 12, +44 20 7946 0958…

## `inputDatasetId` (type: `string`):

Pick another Apify dataset, e.g. the output of a lead scraper run, whose phone numbers should be validated. Set the name of the field that holds them in "Phone field".

## `phoneField` (type: `string`):

Name of the field that holds the phone number in the input dataset. Dot notation is supported (e.g. contact.phone).

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

ISO country code used for numbers written without a +country prefix. US by default.

## `callingHoursStart` (type: `integer`):

Start of the allowed calling window in the recipient's local time (TCPA: 8).

## `callingHoursEnd` (type: `integer`):

End of the allowed calling window in the recipient's local time (TCPA: 21 = 9 pm).

## `dedupe` (type: `boolean`):

Return each number only once, comparing the normalized E.164 form. Duplicates are not charged.

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

Save only valid numbers. You are only charged for saved results.

## `maxItems` (type: `integer`):

Maximum number of phone numbers to save. You are charged per result, so this also caps your cost.

## Actor input object example

```json
{
  "phoneNumbers": [
    "(512) 474-5171",
    "212.736.5000",
    "+1 415 555 2671",
    "1-800-275-2273",
    "+1 (416) 555-0123",
    "(555) 123-4567",
    "+44 20 7946 0958",
    "12345"
  ],
  "phoneField": "phone",
  "defaultCountry": "US",
  "callingHoursStart": 8,
  "callingHoursEnd": 21,
  "dedupe": true,
  "onlyValid": false,
  "maxItems": 100
}
```

# 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 = {
    "phoneNumbers": [
        "(512) 474-5171",
        "212.736.5000",
        "+1 415 555 2671",
        "1-800-275-2273",
        "+1 (416) 555-0123",
        "(555) 123-4567",
        "+44 20 7946 0958",
        "12345"
    ],
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("waags/us-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 = {
    "phoneNumbers": [
        "(512) 474-5171",
        "212.736.5000",
        "+1 415 555 2671",
        "1-800-275-2273",
        "+1 (416) 555-0123",
        "(555) 123-4567",
        "+44 20 7946 0958",
        "12345",
    ],
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("waags/us-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 '{
  "phoneNumbers": [
    "(512) 474-5171",
    "212.736.5000",
    "+1 415 555 2671",
    "1-800-275-2273",
    "+1 (416) 555-0123",
    "(555) 123-4567",
    "+44 20 7946 0958",
    "12345"
  ],
  "maxItems": 100
}' |
apify call waags/us-phone-number-validator --silent --output-dataset

```

## MCP server setup

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