API Depot/APIs/Phone Number Validation

Phone Number Validation

live

Validate and parse phone numbers from any country using Google's libphonenumber. Returns country, line type (mobile/landline/VoIP), and E.164 / national / international formats.

POST /v1/phone/validatePer request

Request

FieldTypeDescription
phone_number*stringPhone number — include + prefix for international format
default_regionstring | nullISO 3166-1 alpha-2 fallback region (e.g. PT, US, GB)

Response

FieldTypeDescription
validbooleanTrue if the number passes full libphonenumber validation
possiblebooleanTrue if the format is plausible (less strict than valid)
phone_numberstringOriginal input as submitted
national_formatstring | nullFormatted for domestic dialling (e.g. 912 345 678)
international_formatstring | nullFormatted for international dialling (e.g. +351 912 345 678)
country_codeinteger | nullITU-T country calling code (e.g. 351)
region_codestring | nullISO 3166-1 alpha-2 region (e.g. PT)
line_typestring | nullMOBILE, FIXED_LINE, FIXED_LINE_OR_MOBILE, TOLL_FREE, PREMIUM_RATE, VOIP, UNKNOWN
e164string | nullE.164 canonical format (e.g. +351912345678)

Example

Request

{
  "phone_number": "+351912345678"
}

Response

{
  "valid": true,
  "possible": true,
  "phone_number": "+351912345678",
  "national_format": "912 345 678",
  "international_format": "+351 912 345 678",
  "country_code": 351,
  "region_code": "PT",
  "line_type": "MOBILE",
  "e164": "+351912345678"
}

Notes

  • Sync endpoint — pure computation, under 10ms.
  • valid: false is a legitimate response — the number was parsed but failed full validation.
  • Use default_region only for local numbers without a country prefix.
  • Powered by Google's libphonenumber (phonenumbers Python package).

Try it