
Numverify
Data ValidationGlobal Phone Number Validation & Lookup JSON API Real-time REST API supporting 232 countries
📚 Documentation & Examples
Everything you need to integrate with Numverify
🚀 Quick Start Examples
// Numverify API Example
const response = await fetch('https://numverify.com/', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);Using the Numverify API with JavaScript
The Numverify API is a public API that allows you to easily verify phone numbers and retrieve information about them. In this tutorial, we will explore how to use the Numverify API with JavaScript.
How to Get a Numverify API Key
- Sign up for a free account at numverify.com (the free plan needs no credit card).
- After registering, your API access key appears in your account dashboard.
- Pass it as the
access_keyquery parameter on a plain GET request — Numverify does not use POST.
The free plan includes 100 API requests per month and validates numbers over the HTTP endpoint (HTTPS is reserved for paid plans). The endpoint is apilayer.net/api/validate:
curl "http://apilayer.net/api/validate?access_key=YOUR_API_KEY&number=14158586273&country_code=&format=1"
The JSON response includes valid, international_format, country_code, location, carrier and line_type. If you pass a national (non-+E.164) number, add the optional country_code parameter (e.g. country_code=US) so Numverify knows how to interpret it. This also corrects a common mistake: the request is a GET with query parameters, not a JSON POST body.
Making requests to the Numverify API
To make requests to the Numverify API, you can use the built-in fetch function in JavaScript. Here is an example code snippet that shows you how to make a request to the Numverify API and retrieve information about a phone number:
fetch('http://apilayer.net/api/validate', {
method: 'POST',
body: JSON.stringify({access_key: YOUR_API_KEY, number: PHONE_NUMBER}),
headers: {'Content-type': 'application/json'}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(err => console.error(err));
In the above code, replace YOUR_API_KEY with your actual API key, and PHONE_NUMBER with the phone number you want to verify.
Handling the response
Once you make a request to the Numverify API, you will receive a response in JSON format. Here is an example response:
{
"valid": true,
"number": "14158586273",
"local_format": "4158586273",
"international_format": "+14158586273",
"country_prefix": "+1",
"country_code": "US",
"country_name": "United States of America",
"location": "San Francisco",
"carrier": "AT&T Mobility LLC",
"line_type": "mobile"
}
You can access the fields in the response just like you would with any JSON object in JavaScript. For example, you can access the country code like this:
console.log(data.country_code);
Conclusion
In this tutorial, we have explored how to use the Numverify API with JavaScript. By following these simple steps, you can easily verify phone numbers and retrieve information about them. If you have any questions or feedback, feel free to leave a comment below.









