Number Insight Basic

You can use Nexmo's Number Insight Basic API to retrieve local and international representations of a phone number by doing semantic checks on the number you submit. This can help you normalise and consistently print numbers in your user interface and gives you information to help you decide if a phone number accept the phone number entered by your user, or ask them to check and correct it.

Number Insight Basic API is a free synchronous, easy-to-use RESTful web service. For any phone number you can:

  • Retrieve the international and local format.
  • Know the country where the number is registered.
curl -X "POST" "https://api.nexmo.com/ni/basic/json" \
-d "api_key=API_KEY" \
-d "api_secret=API_SECRET" \
-d "number=447700900000"
import com.nexmo.client.NexmoClient;
import com.nexmo.client.auth.AuthMethod;
import com.nexmo.client.insight.BasicInsightResponse;

AuthMethod auth = new TokenAuthMethod(API_KEY, API_SECRET);
NexmoClient client = new NexmoClient(auth);

BasicInsightResponse response = client.getInsightClient().getBasicNumberInsight(TO_NUMBER);
<?php 
require_once __DIR__ . '/../vendor/autoload.php';

$basic  = new \Nexmo\Client\Credentials\Basic(NEXMO_API_KEY, NEXMO_API_SECRET);
$client = new \Nexmo\Client($basic);

$response = $client->insights()->basic('447700900000');
import nexmo

client = nexmo.Client(key=API_KEY, secret=API_SECRET)
resp = client.get_basic_number_insight({'number': '447700900000'})
require 'nexmo'

client = Nexmo::Client.new(api_key: 'API_KEY', api_secret: 'API_SECRET')

client.number_insight.basic(number: '447700900000')
nexmo insight:basic 447700900000

The response from the API contains the following data:

{
    "status": 0,
    "status_message": "Success",
    "request_id": "fcb1e9a2-db9c-4ea2-84be-4e60da45e187",
    "international_format_number": "447700900000",
    "national_format_number": "07700 900000",
    "country_code": "GB",
    "country_code_iso3": "GBR",
    "country_name": "United Kingdom",
    "country_prefix": "44"
}
<?xml version="1.0" encoding="UTF-8"?>
<format>
  <request_id>fcb1e9a2-db9c-4ea2-84be-4e60da45e187</request_id>
  <international_format_number>447700900000</international_format_number>
  <local_number country_code="GB" country_code_iso3="GBR" country_name="United Kingdom" country_prefix="44">07700 900000</local_number>
  <error code="0">Success</error>
</format>