
Phone number verification is vital for business and eCommerce applications that want to ensure they are collecting quality customer contact data. But, before you implement a number verification service, take a moment to learn about one of the best phone number verification services on the market the numverify API.
What is Numverify API?
The numverify API is global phone number validation and lookup service. It is platform agnostic and offers a simple connection to any platform. Also need to verify email addresses? A great API to pair with numverify is an email validator api.
Features of the Numverify API
APILayer built and maintains the Numverify API. APILayer is one of the leading providers of business-grade Web APIs & cloud-based micro-service applications for developers and companies of any size.
- Number Validation – Keep your user database clean and fight fraud by validating your contact data.
- Swift & Secure API – The API has an easy-to-integrate URL structure
- Advanced Tools – Configure lookup options with a set of parameters
- Cost-effective API – multi-tier price level has a pricing option suitable for your business
Starting Node.js Web App
Note: you must have NODEJS installed on your machine.
Follow these commands to create a project folder, initialize it with Node modules, and configure it using the project config file.
Fristly, open your terminal and type this command to install the required node packages.


Here is the project structure. You should download or copy the static files first.

This is the endpoint we are going to utilize. Its response structure is pretty straightforward.

1 2 3 4 5 6 7 8 9 10 11 12 |
{ "valid": true, "number": "14158586273", "local_format": "4158586273", "international_format": "+14158586273", "country_prefix": "+1", "country_code": "US", "country_name": "United States of America", "location": "Novato", "carrier": "AT&T Mobility LLC", "line_type": "mobile" } |
After you have successfully got your API access key and created the project structure shown above, you can copy the source code to the main app.js file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
const express = require("express") const axios = require("axios") const app = express() const port = 8080 app.use(express.static('public')) app.use('/css', express.static(__dirname + 'public/css')) app.use('/js', express.static(__dirname + 'public/js')) app.set('views', './src/views') app.set('view engine', 'ejs') app.get("/verify/:number", async function(req, res) { try { const API_ACC_KEY = "23121cc5b8b2c2b9f58ba9081d7b70c7"; const approval = await axios.get( `http://apilayer.net/api/validate?access_key=${API_ACC_KEY}&number=${req.params.number}&country_code=&format=1` ); res.render("numverify", { verify: approval.data }); } catch (error) { if (error.response) { console.log(error.response.data); } else if (error.request) { console.log(error.request); } else { console.log("Error", error.message); } } }); app.get('/', (req, res) => res.send('Index Page - Numverify API + APILayer.com')) app.get('/api/:version', function(req, res) { res.send(req.params.version); }); app.listen(port, () => console.log(`Running on ${port} port`)) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<div class="heading"> <h2>Number verification</h2> </div> <div class="row"> <div class="col-md-6 col-lg-4"> <div class="project-card-no-image"> <h3>Valid?</h3> <h4><%- verify.valid %></h4> <div class="tags"></div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="project-card-no-image"> <h3>Number</h3> <h4><%- verify.number %></h4> <div class="tags"></div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="project-card-no-image"> <h3>Country Name</h3> <h4><%- verify.country_name %></h4> <div class="tags"></div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="project-card-no-image"> <h3>Location</h3> <h4><%- verify.location %></h4> <div class="tags"></div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="project-card-no-image"> <h3>Carrier</h3> <h4><%- verify.carrier %></h4> <div class="tags"></div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="project-card-no-image"> <h3>Country Prefix</h3> <h4><%- verify.country_prefix %></h4> <div class="tags"></div> </div> </div> </div> |
For better development, we can also add a nodemon package that reloads the application when there is a change in the source code. In this case, we installed nodemon when we were initializing the project above.
Here is the change we need on the package.json configuration file.

Start the web application with this command:


Be sure to head over and check out the NumVerify API right now!