Validate Phone Number
The Validate Phone Number endpoint validates a phone number and returns the formatted phone number and, optionally, the Caller-ID name.
NOTE
This endpoint supports phone numbers that conform to the North American Numbering Plan (NANP).
WARNING
Caller Name (CNAME / Caller-ID name) information is only available for US phone numbers.
Endpoint GET
https://api.ttgtoolbox.com/v1/validate/phonenumber/phone_number
Required path parameters
This endpoint uses the GET
method and has the following required path parameters.
phone_numberstringrequired
The phone number to validate.
Formatting characters such as +
, -
, #
, ,
, :
, .
and spaces
are allowed and generally ignored by the validation algorithm.
Optional query parameters
queryNameboolean
Use the optional queryName=true
to perform a Caller-ID / CNAME lookup. The default value is queryName=false
.
Example request URL
https://api.ttgtoolbox.com/v1/validate/phonenumber/855-564-4284
Example request URL with optional query parameter
https://api.ttgtoolbox.com/v1/validate/phonenumber/1234567890?queryName=true
An example valid response
{
"callingCode": "1",
"countryCode": "US",
"phoneNumber": "+18555644284",
"nationalFormat": "(855) 564-4284",
"valid": true,
"validationErrors": [],
"credits": 0
}
An example invalid response
{
"callingCode": null,
"countryCode": null,
"phoneNumber": "+11800-588-2300empire",
"nationalFormat": "8005882300367473",
"valid": false,
"validationErrors": ["TOO_LONG"],
"credits": 0
}