Skip to content

Validate Phone Number

Request

Checks that the phone number provided is in a valid format within the country for the dial prefix provided. Note that this doesn't actually check that the phone number exists, just that it is in a valid format. If the error key returns false, it means that the phone number is valid.

Note: The return value includes the provided phone number, re-formatted correctly in local format, in the data.num key. Additionally, the dial prefix is also returned in the data.cc key. Therefore, it is simple to re-build this into AVANSER format as follows: +{cc}-{num}.

Errors

Error CodeError TypeError Message
-1019INVALID-PHONE-NUMBERInvalid phone number
Security
accessToken
Query
ccstringrequired

The dial prefix of the country that the phone number is for.

phonestringrequired

The phone number to validate, in local format.

curl -i -X GET \
  'https://p3.avanser.com/app/checknumber?cc=string&phone=string&token=YOUR_API_KEY_HERE'

Responses

Phone number format validation result.

Bodyapplication/json
timestampintegerrequired

The time that the API response left the server, represented as the number of seconds since the UNIX epoch.

Example:1508903167
exectionnumber

The number of seconds that it took to process the API request.

Example:0.00041531896591187
errorbooleanrequired

Boolean indicating whether there was an error returned by the API request.

Example:false
dataobjectrequired

The data returned by the API. The format varies depending on the API function that was called.

Response
{ "timestamp": 1508979483, "exection": 0.00013305497169495, "error": false, "data": { "country": "AU", "cc": 61, "num": "0412345678", "type": "mobile" } }