David Walsh Blog

Phone Number Validation with numverify

When we think about form validation, phone numbers aren’t the most pressing bit of information to validate, but if the phone number is absolutely critical to your business or application, you’ll want to do all you can to precisely ensure the number is correct.  And the truth is most single-input phone number elements aren’t masked and don’t ask for enough information so users provide their phone number with and without dashes, parens, and even without country or area codes, making the phone number field a bit of an unsanitized, abused field.

How can you do more advanced phone number validation and analyzation?  You can use numverify, a complete, reliable, easy to use phone number validation service!

Quick Hits

Using numverify

Just like currencylayer and eversign, the numverify API is super easy to use, requiring you to only provide an API key and a phone number:

curl http://apilayer.net/api/validate?access_key=YOUR_ACCESS_KEY&number=14158586273

This call provides some really detailed information:

   "valid": true,   
   "local_format": "4158586273",
   "intl_format": "+14158586273",
   "country_code": "US",
   "country_name": "United States of America",
   "location": "Novato",
   "carrier": "AT&T Mobility LLC",
   "line_type": "mobile"

Let’s have a detailed look at the response:

numverify is Awesome

When I think of validation, I think of regular expressions and basic data scrubbing, but numverify provides so much more information — country, line type, and carrier information are awesome added bonuses to your traditional phone number insight.  numverify is an awesome utility for keeping your phone number input valid and informative — give it a try!