Phone Number Online Validation API

Integrate our Online Phone Number Validation API directly into your sign-up forms or web apps and allow your website visitors to fix errors in their data instantly - only valid, usable phone numbers will be accepted. To ensure full compliancy with the FCC Telephone Consumer Protection Act (TCPA), the API also detects the line type (landline vs. mobile).

Keep your customer database clean and focus on real people - real-time phone number validation is easy to implement and has a lot of benefits for your business. The best way to capture good leads is to verify contact information right at the point of entry.

How Does It Work?

Integrating our Phone Validation API into the Javascript, PHP, Java, C#, VB.NET code of your website or application or into content management systems (CMS) like Drupal, Typo3, WordPress or Joomla is very easy now - all you have to do is to send a HTTP or HTTPS request to our servers! The request returns a result code and the phone number in standardized format.

API Keys

Before you start, please request a free trial API key first. Your API key will be delivered by email within minutes. Once you have received the API key you can test our online phone number validation API here.

If you want to validate more than 100 phone numbers per month, please have a look at our pay-as-you-go pricing model and the subscription plans we offer.

API Integration: Code Examples


<script type="text/javascript" src="path/to/jquery"></script>
<script type="text/javascript">
$(document).ready(function() {
    ...
    // send API request
    PhoneNumber = 'phone number';
    CountryCode = 'us';
    Locale = 'en-US';
    $.ajax({
        url: 'http://api.phone-validator.net/api/v2/verify',
        type: 'POST',
        data: { PhoneNumber: PhoneNumber, CountryCode: CountryCode,
                Locale: Locale, APIKey: 'your API key'},
        dataType: 'json',
        success: function (json) {
            // check API result
            if (typeof(json.status) != "undefined") {
                statuscode = json.status;
                switch (statuscode) {
                    case "VALID_CONFIRMED":
                    case "VALID_UNCONFIRMED":
                        linetype = json.linetype;
                        location = json.location;
                        countrycode = json.countrycode;
                        formatnational = json.formatnational;
                        formatinternational = json.formatinternational;
                        break;
                    case "INVALID": break;
                    default:
                }
            }
        }
    });
    ...
});
</script>

...
// build API request
$APIUrl = 'http://api.phone-validator.net/api/v2/verify';
$PhoneNumber = "phone number";
$CountryCode = "us";
$Locale = "en-US";
$Params = array('PhoneNumber' => $PhoneNumber,
                'CountryCode' => $CountryCode,
                'Locale' => $Locale,
                'APIKey' => 'your API key');
$Request = @http_build_query($Params);
$ctxData = array(
     'method' => "POST",
     'header' => "Connection: close\r\n".
     "Content-Length: ".strlen($Request)."\r\n",
     'content'=> $Request);
$ctx = @stream_context_create(array('http' => $ctxData));

// send API request
$result = json_decode(@file_get_contents(
    $APIUrl, false, $ctx));

// check API result
switch($result->{'status'}) {
    case "VALID_CONFIRMED":
    case "VALID_UNCONFIRMED":
        $linetype = $result->{'linetype'};
        $location = $result->{'location'};
        $countrycode = $result->{'countrycode'};
        $formatnational = $result->{'formatnational'};
        $formatinternational = $result->{'formatinternational'};
    case "INVALID": 
        echo $PhoneNumber." is ".$result->{'status'};
        break;
    default:
        echo $result->{'info'};
}

...

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

import org.apache.http.util.EntityUtils;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
...
HttpClient client = new DefaultHttpClient();
String PhoneNumber = "phone number";
String CountryCode = "us";
String Locale = "en";
String ApiKey = "your API key";
String APIURL = "http://api.phone-validator.net/api/v2/verify";
try {
    HttpPost request = new HttpPost(APIURL);
    List <NameValuePair> Input = new ArrayList<NameValuePair>();
    Input.add(new BasicNameValuePair("PhoneNumber", PhoneNumber));
    Input.add(new BasicNameValuePair("CountryCode", CountryCode));
    Input.add(new BasicNameValuePair("Locale", Locale));
    Input.add(new BasicNameValuePair("APIKey", ApiKey));
    request.setEntity(new UrlEncodedFormEntity(Input));
    HttpResponse response = client.execute(request);
    HttpEntity entity = response.getEntity();
    String Output = EntityUtils.toString(entity, "UTF-8");
    JSONParser parser = new JSONParser();
    Object obj = parser.parse(Output);
    JSONObject jsonObject = (JSONObject) obj;
    String status = (String) jsonObject.get("status");
    switch (status) {
        case "VALID_CONFIRMED":
        case "VALID_UNCONFIRMED":
            String LineType = (String) jsonObject.get("linetype");
            String Location = (String) jsonObject.get("location");
            String CountryCode = (String) jsonObject.get("countrycode");
            String FormatNational = (String) jsonObject.get("formatnational");
            String FormatIntl = (String) jsonObject.get("formatinternational");
            break;
        case "INVALID": break;
        default:
    }
    ...
} catch (IOException e) {
    e.printStackTrace();
} catch (ParseException e) {
    e.printStackTrace();
} finally {
    client.getConnectionManager().shutdown();
}
...

// C# .NET 4.5
using System;
using System.Collections.Generic;
using System.Net.Http;
...

private class APIResult
{
    public String status { get; set; }
    public String linetype { get; set; }
    public String location { get; set; }
    public String countrycode { get; set; }
    public String formatnational { get; set; }
    public String formatinternational { get; set; }
}

const String APIURL = "http://api.phone-validator.net/api/v2/verify";
HttpClient client = new HttpClient();
String PhoneNumber = "phone number";
String CountryCode = "us";
String Locale = "en-US";
String ApiKey = "your API key";

var postData = new List<KeyValuePair<string, string>>();
postData.Add(new KeyValuePair<string, string>("PhoneNumber", PhoneNumber));
postData.Add(new KeyValuePair<string, string>("CountryCode", CountryCode));
postData.Add(new KeyValuePair<string, string>("Locale", Locale));
postData.Add(new KeyValuePair<string, string>("APIKey", APIKey));

HttpContent content = new FormUrlEncodedContent(postData);

HttpResponseMessage result = client.PostAsync(APIURL, content).Result;
string resultContent = result.Content.ReadAsStringAsync().Result;

APIResult res = new System.Web.Script.Serialization.JavaScriptSerializer().
                    Deserialize<APIResult>(resultContent);

switch (res.status) {
    case "VALID_CONFIRMED":
    case "VALID_UNCONFIRMED":
        String LineType = res.linetype;
        String Location = res.location;
        String CountryCode = res.countrycode;
        String FormatNational = res.formatnational;
        String FormatInternational = res.formatinternational;
        break;
    case "INVALID": break;
    default:
}
...

' VB.NET 4.5
...
Private Sub checkPhoneNumber(ByVal PhoneNumber As String,
                       ByVal CountryCode As String,
                       ByVal Locale As String,
                       ByVal APIKey As String)
    Const APIURL As String = "http://api.phone-validator.net/api/v2/verify"
    Using client As New Net.WebClient
      Dim postData As New Specialized.NameValueCollection
      postData.Add("PhoneNumber", PhoneNumber)
      postData.Add("CountryCode", CountryCode)
      postData.Add("Locale", Locale)
      postData.Add("APIKey", APIKey)
      Dim reply = client.UploadValues(APIURL, "POST", postData)
      Dim data As String = (New System.Text.UTF8Encoding).GetString(reply)
      Dim res = New System.Web.Script.Serialization.JavaScriptSerializer().
        Deserialize(Of APIResult)(data)        
      Select Case res.status
        Case "VALID_CONFIRMED"
        Case "VALID_UNCONFIRMED"
            Dim LineType As String = res.linetype
            Dim Location As String = res.location
            Dim CountryCode As String = res.countrycode
            Dim FormatNational As String = res.formatnational
            Dim FormatInternational As String = res.formatinternational
        Case "INVALID"
            ...
        Case Else
            ...
      End Select
    End Using
End Sub

Private Class APIResult
    Public status As String
    Public linetype As String
    Public location As String
    Public countrycode As String
    Public formatnational As String
    Public formatinternational As String
End Class
...
API URLhttp|https://api.phone-validator.net/api/v2/verify
MethodGET or POST
Input Parameters
   PhoneNumberphone number to validate (string)
   CountryCodetwo letter ISO 3166-1 country code (string)
   LocaleIETF language tag for Geocoding [default 'en-US'] (string)
   Mode'extensive' | 'express' [default 'extensive'] (string)
   APIKeyyour API key (string)
   Timeouttimeout in seconds [default 10s, min 5s, max 300s] (int)
API Result (JSON)
   statusVALID_CONFIRMED, VALID_UNCONFIRMED, INVALID or error: DELAYED, RATE_LIMIT_EXCEEDED, API_KEY_INVALID_OR_DEPLETED
   linetypeFIXED_LINE, MOBILE, VOIP, TOLL_FREE, PREMIUM_RATE, SHARED_COST, PERSONAL_NUMBER, PAGER, UAN, VOICEMAIL
   locationgeographical location (city, county, state)
   countrycodetwo letter ISO 3166-1 country code
   formatnationalphone number in national format
   formatinternationalphone number in international format