Use the CheckPhoneNumber
method to validate and get info about a single phone number. (Use CheckPhoneNumbers
to check multiple numbers.)
Syntax
CheckPhoneNumber(PhoneNumber, LicenseKey)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
PhoneNumber | The phone number that you want to check. | String | True | 7575449510 |
LicenseKey | Your license key. | String | True | 00000000-0000-0000-0000-000000000000 |
Response
Returns: PhoneReturn
object
Code Samples
You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.
- C#
- Java
- Python
- GET Request
- POST Request
- SOAP 1.1 Request
- SOAP 1.1 Response
- SOAP 1.2 Request
- SOAP 1.2 Response
- XML Response
C#
// https://ws.esendex.us/phoneverify/phoneverify.asmx?wsdl was added as a Service Reference and given the name WSDL
using WSDL;
var client = new PhoneVerifySoapClient(PhoneVerifySoapClient.EndpointConfiguration.PhoneVerifySoap);
var phoneNumber = "17575449510";
var licenseKey = "YOUR_LICENSE_KEY";
var response = await client.CheckPhoneNumberAsync(phoneNumber, licenseKey);
Console.WriteLine("Company: " + (string.IsNullOrEmpty(response.Company) ? "No Information Found" : response.Company));
Console.WriteLine("Valid: " + response.Valid);
Console.WriteLine("Use: " + (string.IsNullOrEmpty(response.Use) ? "No Information Found" : response.Use));
Console.WriteLine("State: " + (string.IsNullOrEmpty(response.State) ? "No Information Found" : response.State));
Console.WriteLine("Switch: " + (string.IsNullOrEmpty(response.Switch) ? "No Information Found" : response.Switch));
Console.WriteLine("RC: " + (string.IsNullOrEmpty(response.RC) ? "No Information Found" : response.RC));
Console.WriteLine("OCN: " + (string.IsNullOrEmpty(response.OCN) ? "No Information Found" : response.OCN));
Console.WriteLine("Original Number: " + (string.IsNullOrEmpty(response.OriginalNumber) ? "No Information Found" : response.OriginalNumber));
Console.WriteLine("Clean Number: " + (string.IsNullOrEmpty(response.CleanNumber) ? "No Information Found" : response.CleanNumber));
Console.WriteLine("Switch Name: " + (string.IsNullOrEmpty(response.SwitchName) ? "No Information Found" : response.SwitchName));
Console.WriteLine("Switch Type: " + (string.IsNullOrEmpty(response.SwitchType) ? "No Information Found" : response.SwitchType));
Console.WriteLine("Country: " + (string.IsNullOrEmpty(response.Country) ? "No Information Found" : response.Country));
Console.WriteLine("CLLI: " + (string.IsNullOrEmpty(response.CLLI) ? "No Information Found" : response.CLLI));
Console.WriteLine("Prefix Type: " + (string.IsNullOrEmpty(response.PrefixType) ? "No Information Found" : response.PrefixType));
Console.WriteLine("LATA: " + (string.IsNullOrEmpty(response.LATA) ? "No Information Found" : response.LATA));
Console.WriteLine("SMS: " + (string.IsNullOrEmpty(response.sms) ? "No Information Found" : response.sms));
Console.WriteLine("Email: " + (string.IsNullOrEmpty(response.Email) ? "No Information Found" : response.Email));
Console.WriteLine("Date Assigned: " + (string.IsNullOrEmpty(response.AssignDate) ? "No Information Found" : response.AssignDate));
Console.WriteLine("Telecom City: " + (string.IsNullOrEmpty(response.TelecomCity) ? "No Information Found" : response.TelecomCity));
Console.WriteLine("Telecom County: " + (string.IsNullOrEmpty(response.TelecomCounty) ? "No Information Found" : response.TelecomCounty));
Console.WriteLine("Telecom State: " + (string.IsNullOrEmpty(response.TelecomState) ? "No Information Found" : response.TelecomState));
Console.WriteLine("Telecom ZIP: " + (string.IsNullOrEmpty(response.TelecomZip) ? "No Information Found" : response.TelecomZip));
Console.WriteLine("Time Zone: " + (string.IsNullOrEmpty(response.TimeZone) ? "No Information Found" : response.TimeZone));
Console.WriteLine("Latitude: " + (string.IsNullOrEmpty(response.Lat) ? "No Information Found" : response.Lat));
Console.WriteLine("Longitude: " + (string.IsNullOrEmpty(response.Long) ? "No Information Found" : response.Long));
Console.WriteLine("Wireless: " + response.Wireless);
Console.ReadLine();
Java
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class CheckPhoneNumber {
public static void main(String[] args) {
try {
URL url = new URL("https://ws.esendex.us/phoneverify/phoneverify.asmx/CheckPhoneNumber?"
+ "PhoneNumber=17575449510"
+ "&LicenseKey=YOUR LICENSE KEY");
try {
InputStream in = url.openStream();
StreamSource source = new StreamSource(in);
printResult(source);
} catch (java.io.IOException e) {
e.printStackTrace();
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
private static void printResult(Source source) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
StreamResult sr = new StreamResult(bos);
Transformer trans = TransformerFactory.newInstance().newTransformer();
Properties oprops = new Properties();
oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperties(oprops);
trans.transform(source, sr);
System.out.println("**** Response ******");
System.out.println(bos.toString());
bos.close();
System.out.println();
} catch (Exception e) {
}
}
}
Python
import zeep
client = zeep.Client(wsdl="https://ws.esendex.us/phoneverify/phoneverify.asmx?wsdl")
phone_number = "17575449510"
license_key = "00000000-0000-0000-0000-000000000000"
response = client.service.CheckPhoneNumber(phone_number, license_key)
print(response)
GET Request
GET /phoneverify/phoneverify.asmx/CheckPhoneNumber?PhoneNumber=string&LicenseKey=string HTTP/1.1
Host: ws.esendex.us
POST Request
POST /phoneverify/phoneverify.asmx/CheckPhoneNumber HTTP/1.1
Host: ws.esendex.us
Content-Type: application/x-www-form-urlencoded
Content-Length: length
PhoneNumber=string&LicenseKey=string
SOAP 1.1 Request
POST /phoneverify/phoneverify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
<PhoneNumber>string</PhoneNumber>
<LicenseKey>string</LicenseKey>
</CheckPhoneNumber>
</soap:Body>
</soap:Envelope>
SOAP 1.1 Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CheckPhoneNumberResponse xmlns="http://ws.cdyne.com/PhoneVerify/query">
<CheckPhoneNumberResult>
<Company>string</Company>
<Valid>boolean</Valid>
<Use>string</Use>
<State>string</State>
<Switch>string</Switch>
<RC>string</RC>
<OCN>string</OCN>
<OriginalNumber>string</OriginalNumber>
<CleanNumber>string</CleanNumber>
<SwitchName>string</SwitchName>
<SwitchType>string</SwitchType>
<Country>string</Country>
<CLLI>string</CLLI>
<PrefixType>string</PrefixType>
<LATA>string</LATA>
<sms>string</sms>
<Email>string</Email>
<AssignDate>string</AssignDate>
<TelecomCity>string</TelecomCity>
<TelecomCounty>string</TelecomCounty>
<TelecomState>string</TelecomState>
<TelecomZip>string</TelecomZip>
<TimeZone>string</TimeZone>
<Lat>string</Lat>
<Long>string</Long>
<Wireless>boolean</Wireless>
<LRN>string</LRN>
</CheckPhoneNumberResult>
</CheckPhoneNumberResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2 Request
POST /phoneverify/phoneverify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
<PhoneNumber>string</PhoneNumber>
<LicenseKey>string</LicenseKey>
</CheckPhoneNumber>
</soap12:Body>
</soap12:Envelope>
SOAP 1.2 Response
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CheckPhoneNumberResponse xmlns="http://ws.cdyne.com/PhoneVerify/query">
<CheckPhoneNumberResult>
<Company>string</Company>
<Valid>boolean</Valid>
<Use>string</Use>
<State>string</State>
<Switch>string</Switch>
<RC>string</RC>
<OCN>string</OCN>
<OriginalNumber>string</OriginalNumber>
<CleanNumber>string</CleanNumber>
<SwitchName>string</SwitchName>
<SwitchType>string</SwitchType>
<Country>string</Country>
<CLLI>string</CLLI>
<PrefixType>string</PrefixType>
<LATA>string</LATA>
<sms>string</sms>
<Email>string</Email>
<AssignDate>string</AssignDate>
<TelecomCity>string</TelecomCity>
<TelecomCounty>string</TelecomCounty>
<TelecomState>string</TelecomState>
<TelecomZip>string</TelecomZip>
<TimeZone>string</TimeZone>
<Lat>string</Lat>
<Long>string</Long>
<Wireless>boolean</Wireless>
<LRN>string</LRN>
</CheckPhoneNumberResult>
</CheckPhoneNumberResponse>
</soap12:Body>
</soap12:Envelope>
XML Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<PhoneReturn xmlns="http://ws.cdyne.com/PhoneVerify/query">
<Company>string</Company>
<Valid>boolean</Valid>
<Use>string</Use>
<State>string</State>
<Switch>string</Switch>
<RC>string</RC>
<OCN>string</OCN>
<OriginalNumber>string</OriginalNumber>
<CleanNumber>string</CleanNumber>
<SwitchName>string</SwitchName>
<SwitchType>string</SwitchType>
<Country>string</Country>
<CLLI>string</CLLI>
<PrefixType>string</PrefixType>
<LATA>string</LATA>
<sms>string</sms>
<Email>string</Email>
<AssignDate>string</AssignDate>
<TelecomCity>string</TelecomCity>
<TelecomCounty>string</TelecomCounty>
<TelecomState>string</TelecomState>
<TelecomZip>string</TelecomZip>
<TimeZone>string</TimeZone>
<Lat>string</Lat>
<Long>string</Long>
<Wireless>boolean</Wireless>
<LRN>string</LRN>
</PhoneReturn>