Validation

International Phone Validator

Validates phone numbers globally, returns E.164 format, country, dialing code, and line type with national formatting.

POST /api/validate-phone
~50ms latency API Key Auth

What this API does

The International Phone Validator API parses and validates phone numbers from any country, normalizing them to the international E.164 standard. It detects the country of origin, returns the dialing code and national number, and determines the line type (mobile, landline, or fixed_or_mobile). It also provides a formatted national representation of the number.

Code Examples

curl -X POST "https://api.atomicapis.dev/api/validate-phone" \
  -H "X-RapidAPI-Proxy-Secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumber": "+14155552671",
    "defaultCountry": "US"
  }'

How It Works

The International Phone Validator API uses a custom rule engine to handle phone numbers in virtually any format. Whether your users enter numbers with country codes, area codes in parentheses, dashes, dots, or spaces, the API strips formatting, detects the country, and normalizes them to the standard E.164 format.

Key Features

  • E.164 Normalization: Converts any valid phone number to the international standard format (e.g., +15551234567)
  • Country Detection: Automatically identifies the country based on number prefix and validates against regional rules
  • Line Type Detection: Determines if the number is mobile, landline, fixed_or_mobile, toll_free_or_special, or premium
  • National Formatting: Returns the phone number formatted in the national convention for the detected country

Request Parameters

Parameter Type Required Description
phoneNumber string Required The phone number to validate
defaultCountry string Optional ISO 3166-1 alpha-2 country code (e.g., "US", "GB") used when the number lacks an international prefix

Response Format

200 OK - Successful Validation
{
  "isValid": true,
  "e164": "+14155552671",
  "countryCode": "US",
  "countryName": "United States",
  "dialingCode": "+1",
  "nationalNumber": "4155552671",
  "numberType": "fixed_or_mobile",
  "formattedNational": "(415) 555-2671",
  "error": null
}
200 OK - Invalid Number
{
  "isValid": false,
  "e164": null,
  "countryCode": null,
  "countryName": null,
  "dialingCode": null,
  "nationalNumber": null,
  "numberType": null,
  "formattedNational": null,
  "error": "Unable to determine country. Provide a defaultCountry or use international format (+...)."
}

Response Fields

Field Type Description
isValid boolean Whether the phone number is valid and properly formatted.
e164 string | null The phone number in E.164 international format (e.g., +15551234567).
countryCode string | null ISO 3166-1 alpha-2 country code (e.g., "US").
countryName string | null Full name of the country (e.g., "United States").
dialingCode string | null International dialing code (e.g., "+1").
nationalNumber string | null The phone number without country code.
numberType string | null Type of line: "mobile", "landline", "fixed_or_mobile", "toll_free_or_special", "premium", or "unknown".
formattedNational string | null The phone number formatted in national format (e.g., "(415) 555-2671").
error string | null Error message if the phone number is invalid, null otherwise.

Use Cases

Form Validation

Validate phone numbers in real-time during user registration, checkout flows, or contact forms. Provide instant feedback and auto-format user input.

// Real-time validation on blur

CRM Cleanup

Standardize and validate existing phone number databases. Identify invalid entries, normalize formats to E.164, and enrich records with country and line type data.

// Batch process CRM records

SMS Campaign Prep

Filter contact lists to mobile numbers only before SMS campaigns. Reduce costs by removing landlines and invalid numbers from your messaging lists.

// Filter for numberType === 'mobile'

Build Constraints

Custom Country-Rule Engine

Phone number parsing and validation uses a custom-built rule engine with per-country definitions for dialing codes, valid national number lengths, trunk prefix handling, and number type detection. Currently supports 28 countries and territories.

Prefix-Based Number Type Detection

Line type detection uses national number prefix patterns to classify numbers as mobile, landline, fixed_or_mobile, toll_free_or_special, or premium. Rules are defined per country based on known numbering plan conventions.

Pure Computation

All validation operations are performed through pure computation with no external API calls required. This ensures sub-50ms response times and high availability with no third-party dependencies.

Related APIs

MCP Integration MCP Ready

What is MCP?

Model Context Protocol (MCP) allows AI assistants like Claude to call this API as a native tool during conversation. Instead of writing HTTP requests, the AI invokes the tool directly — no API keys or boilerplate needed on the client side.

Tool Details

Tool Class
PhoneValidatorTools
Method
ValidatePhone()

Description

Validates international phone numbers with formatting and type detection