Namsor

Phone API – Identify a phone prefix

Namsor's Phone Number Format API intelligently formats and validates phone numbers by analyzing them alongside a person's first and last name. Whether the input number is formatted or unformatted, our API determines the most likely country of residence, assigns the correct international dialing code, and returns the number in standardized E.164 format.


This API is particularly useful for applications requiring accurate contact information, such as CRM systems, user onboarding processes, and data cleansing operations. By incorporating contextual information from names, the API enhances the precision of phone number formatting and validation, ensuring reliable communication channels.

Format Phone Number

Phone prefix from first name (optional), last name (optional), phone number .

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Jamini",
    "lastName": "Roy",
    "internationalPhoneNumberVerified": "+91 98042 01420",
    "phoneCountryIso2Verified": "IN",
    "phoneCountryCode": 91,
    "phoneCountryCodeAlt": 98,
    "phoneCountryIso2": "IN",
    "phoneCountryIso2Alt": "IR",
    "originCountryIso2": "BD",
    "originCountryIso2Alt": "ID",
    "phoneNumber": "09804201420",
    "verified": true,
    "score": 7.659341221254494
}

Format Phone Number analyzes a first name, last name, and a phone number to determine the most likely international phone prefix, country of origin, and the correctly formatted phone number.

  • Precision:Precision gauge
  • Cost: 11 credits per name.
  • Description: Returns the most likely phone prefix, country of residence and format of up to 100 phone numbers using first names and last names.
  • More about: Format Phone Number

HTTP request

http request
POST
https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeBatch
Request header
PropertyRequiredDescription
X-API-KEYRequiredYour Namsor's services API key
information

To get an API key for free, please create an account.

Request body
NameTypeRequiredDescription
personalNamesWithPhoneNumbersArray of objectsRequiredA list of personal names with phone numbers.
[{...}].idStringOptionalUnique identifier.
[{...}].firstNameStringOptionalFirst name (or given name).
[{...}].lastNameStringOptionalLast name (or family name).
[{...}].phoneNumberStringRequiredPhone number, formatted or unformatted.
Response
NameTypeDescriptionEnumerators
personalNamesWithPhoneNumbersArray of objectsList of formatted phone numbers.
[{...}].scriptStringName of the script used for the name, in ISO 15924 format.Script
[{...}].idStringProvided unique identifier.
[{...}].firstNameStringSubmitted first name (or given name).
[{...}].lastNameStringSubmitted last name (or family name).
[{...}].internationalPhoneNumberVerifiedStringPositively verified phone number, in E.164 format (according to LibPhoneNumber).
[{...}].phoneCountryIso2VerifiedStringPositively verified country of origin of the phone number, in ISO 3166-1 alpha-2 format (according to LibPhoneNumber).Country of residence
[{...}].phoneCountryCodeNumberMost likely country calling code.Phone prefix
[{...}].phoneCountryCodeAltNumberSecond most likely country calling code.Phone prefix
[{...}].phoneCountryIso2StringMost likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
[{...}].phoneCountryIso2AltStringSecond most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
[{...}].originCountryIso2StringMost likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
[{...}].originCountryIso2AltStringSecond most likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
[{...}].phoneNumberStringSubmitted phone number.
[{...}].verifiedBooleanIndicates if the phone number could be positively verified using LibPhoneNumber.
[{...}].scoreNumberHigher implies a more reliable result, score is not normalized.

Code sample:

Format Phone Number code sample for shell:

curl --request POST \ 
--url https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeBatch \
--header 'X-API-KEY: your-api-key' \
--header 'Accept: application/json'
--header 'Content-Type: application/json' \
--data '{"personalNamesWithPhoneNumbers":[{"id":"e630dda5-13b3-42c5-8f1d-648aa8a21c42","firstName":"Jamini","lastName":"Roy","phoneNumber":"09804201420"}]}'

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Jamini",
      "lastName": "Roy",
      "phoneNumber": "09804201420"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Jamini",
            "lastName": "Roy",
            "internationalPhoneNumberVerified": "+91 98042 01420",
            "phoneCountryIso2Verified": "IN",
            "phoneCountryCode": 91,
            "phoneCountryCodeAlt": 98,
            "phoneCountryIso2": "IN",
            "phoneCountryIso2Alt": "IR",
            "originCountryIso2": "BD",
            "originCountryIso2Alt": "ID",
            "phoneNumber": "09804201420",
            "verified": true,
            "score": 7.659341221254494
        }
    ]
}

Format Phone Number code sample for java:

HttpResponse<String> response = Unirest.post("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeBatch")
.header("X-API-KEY", "your-api-key")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body("{\"personalNamesWithPhoneNumbers\":[{\"id\":\"e630dda5-13b3-42c5-8f1d-648aa8a21c42\",\"firstName\":\"Jamini\",\"lastName\":\"Roy\",\"phoneNumber\":\"09804201420\"}]}")
.asString();

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Jamini",
      "lastName": "Roy",
      "phoneNumber": "09804201420"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Jamini",
            "lastName": "Roy",
            "internationalPhoneNumberVerified": "+91 98042 01420",
            "phoneCountryIso2Verified": "IN",
            "phoneCountryCode": 91,
            "phoneCountryCodeAlt": 98,
            "phoneCountryIso2": "IN",
            "phoneCountryIso2Alt": "IR",
            "originCountryIso2": "BD",
            "originCountryIso2Alt": "ID",
            "phoneNumber": "09804201420",
            "verified": true,
            "score": 7.659341221254494
        }
    ]
}

Format Phone Number code sample for python:

import requests

url = "https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeBatch"

payload = {
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Jamini",
      "lastName": "Roy",
      "phoneNumber": "09804201420"
    }
  ]
}
headers = {
    "X-API-KEY": "your-api-key",
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Jamini",
      "lastName": "Roy",
      "phoneNumber": "09804201420"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Jamini",
            "lastName": "Roy",
            "internationalPhoneNumberVerified": "+91 98042 01420",
            "phoneCountryIso2Verified": "IN",
            "phoneCountryCode": 91,
            "phoneCountryCodeAlt": 98,
            "phoneCountryIso2": "IN",
            "phoneCountryIso2Alt": "IR",
            "originCountryIso2": "BD",
            "originCountryIso2Alt": "ID",
            "phoneNumber": "09804201420",
            "verified": true,
            "score": 7.659341221254494
        }
    ]
}

Format Phone Number code sample for javascript:

const response = await fetch("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeBatch", {
  "method": "POST",
  "headers": {
    "X-API-KEY": "your-api-key",
    "Accept": "application/json",
    "Content-Type": "application/json"
  },
  "body": JSON.stringify({
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Jamini",
      "lastName": "Roy",
      "phoneNumber": "09804201420"
    }
  ]
})
});

if (response.ok) {
  const data = await response.json(); // Extract JSON data from response
  console.log(data); // View data in the console
} else {
  console.error("The request failed with status:", response.status, response);
}

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Jamini",
      "lastName": "Roy",
      "phoneNumber": "09804201420"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Jamini",
            "lastName": "Roy",
            "internationalPhoneNumberVerified": "+91 98042 01420",
            "phoneCountryIso2Verified": "IN",
            "phoneCountryCode": 91,
            "phoneCountryCodeAlt": 98,
            "phoneCountryIso2": "IN",
            "phoneCountryIso2Alt": "IR",
            "originCountryIso2": "BD",
            "originCountryIso2Alt": "ID",
            "phoneNumber": "09804201420",
            "verified": true,
            "score": 7.659341221254494
        }
    ]
}
  • Precision:Precision gauge
  • Cost: 11 credits per name.
  • Description: Returns the most likely phone prefix, country of residence and format of a phone number using a first name and a last name.
information

For requests with a GET method all parameters are required. For more ease in the use of our requests we recommend that you use the POST method.

HTTP request

http request
GET
https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCode/{firstName}/{lastName}/{phoneNumber}
Request header
PropertyRequiredDescription
X-API-KEYRequiredYour Namsor's services API key
information

To get an API key for free, please create an account.

Request parameters
NameTypeRequiredDescription
firstNameStringRequiredFirst name (or given name).
lastNameStringRequiredLast name (or family name).
phoneNumberStringRequiredPhone number, formatted or unformatted.
Response
NameTypeDescriptionEnumerators
scriptStringName of the script used for the name, in ISO 15924 format.Script
idStringProvided unique identifier.
firstNameStringSubmitted first name (or given name).
lastNameStringSubmitted last name (or family name).
internationalPhoneNumberVerifiedStringPositively verified phone number, in E.164 format (according to LibPhoneNumber).
phoneCountryIso2VerifiedStringPositively verified country of origin of the phone number, in ISO 3166-1 alpha-2 format (according to LibPhoneNumber).Country of residence
phoneCountryCodeNumberMost likely country calling code.Phone prefix
phoneCountryCodeAltNumberSecond most likely country calling code.Phone prefix
phoneCountryIso2StringMost likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
phoneCountryIso2AltStringSecond most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
originCountryIso2StringMost likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
originCountryIso2AltStringSecond most likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
phoneNumberStringSubmitted phone number.
verifiedBooleanIndicates if the phone number could be positively verified using LibPhoneNumber.
scoreNumberHigher implies a more reliable result, score is not normalized.

Code sample:

Format Phone Number code sample for shell:

curl --request GET \ 
--url https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCode/Jamini/Roy/09804201420 \
--header 'X-API-KEY: your-api-key' \
--header 'Accept: application/json'

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Jamini",
    "lastName": "Roy",
    "internationalPhoneNumberVerified": "+91 98042 01420",
    "phoneCountryIso2Verified": "IN",
    "phoneCountryCode": 91,
    "phoneCountryCodeAlt": 98,
    "phoneCountryIso2": "IN",
    "phoneCountryIso2Alt": "IR",
    "originCountryIso2": "BD",
    "originCountryIso2Alt": "ID",
    "phoneNumber": "09804201420",
    "verified": true,
    "score": 7.659341221254494
}

Format Phone Number code sample for java:

HttpResponse<String> response = Unirest.get("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCode/Jamini/Roy/09804201420")
.header("X-API-KEY", "your-api-key")
.header("Accept", "application/json")
.asString();

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Jamini",
    "lastName": "Roy",
    "internationalPhoneNumberVerified": "+91 98042 01420",
    "phoneCountryIso2Verified": "IN",
    "phoneCountryCode": 91,
    "phoneCountryCodeAlt": 98,
    "phoneCountryIso2": "IN",
    "phoneCountryIso2Alt": "IR",
    "originCountryIso2": "BD",
    "originCountryIso2Alt": "ID",
    "phoneNumber": "09804201420",
    "verified": true,
    "score": 7.659341221254494
}

Format Phone Number code sample for python:

import requests

url = "https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCode/Jamini/Roy/09804201420"

headers = {
  "X-API-KEY": "your-api-key",
 "Accept": "application/json"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Jamini",
    "lastName": "Roy",
    "internationalPhoneNumberVerified": "+91 98042 01420",
    "phoneCountryIso2Verified": "IN",
    "phoneCountryCode": 91,
    "phoneCountryCodeAlt": 98,
    "phoneCountryIso2": "IN",
    "phoneCountryIso2Alt": "IR",
    "originCountryIso2": "BD",
    "originCountryIso2Alt": "ID",
    "phoneNumber": "09804201420",
    "verified": true,
    "score": 7.659341221254494
}

Format Phone Number code sample for javascript:

const response = await fetch("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCode/Jamini/Roy/09804201420", {
  "method": "GET",
  "headers": {
    "X-API-KEY": "your-api-key",
    "Accept": "application/json"
  }
});

if (response.ok) {
  const data = await response.json(); // Extract JSON data from response
  console.log(data); // View data in the console
} else {
  console.error("The request failed with status:", response.status, response);
}

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Jamini",
    "lastName": "Roy",
    "internationalPhoneNumberVerified": "+91 98042 01420",
    "phoneCountryIso2Verified": "IN",
    "phoneCountryCode": 91,
    "phoneCountryCodeAlt": 98,
    "phoneCountryIso2": "IN",
    "phoneCountryIso2Alt": "IR",
    "originCountryIso2": "BD",
    "originCountryIso2Alt": "ID",
    "phoneNumber": "09804201420",
    "verified": true,
    "score": 7.659341221254494
}

Format Phone Number Geo

Phone prefix from first name (optional), last name (optional), phone number , country code .

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Teniola",
    "lastName": "Apata",
    "internationalPhoneNumberVerified": "+234 818 647 2651",
    "phoneCountryIso2Verified": "NG",
    "phoneCountryCode": 234,
    "phoneCountryCodeAlt": 62,
    "phoneCountryIso2": "NG",
    "phoneCountryIso2Alt": "ID",
    "originCountryIso2": "NG",
    "originCountryIso2Alt": "CI",
    "phoneNumber": "08186472651",
    "verified": true,
    "score": 2.362918055640346
}

Format Phone Number Geo enhances the basic Format Phone Number feature by incorporating local context for improved accuracy. It analyzes a first name, last name, and phone number to return the most likely international prefix, country of origin, and the properly formatted phone number.

  • Precision:Precision gauge
  • Cost: 11 credits per name.
  • Description: Returns the most likely phone prefix and format of up to 100 phone numbers using first names, last names and geographic context.
  • More about: Format Phone Number Geo

HTTP request

http request
POST
https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeoBatch
Request header
PropertyRequiredDescription
X-API-KEYRequiredYour Namsor's services API key
information

To get an API key for free, please create an account.

Request body
NameTypeRequiredDescription
personalNamesWithPhoneNumbersArray of objectsRequiredA list of personal names with phone numbers and their local context.
[{...}].idStringOptionalUnique identifier.
[{...}].firstNameStringOptionalFirst name (or given name).
[{...}].lastNameStringOptionalLast name (or family name).
[{...}].phoneNumberStringRequiredPhone number, formatted or unformatted.
[{...}].countryIso2StringRequiredMost likely country of residence, in ISO 3166-1 alpha-2 format.
[{...}].countryIso2AltStringOptionalSecond most likely country of residence, in ISO 3166-1 alpha-2 format.
Response
NameTypeDescriptionEnumerators
personalNamesWithPhoneNumbersArray of objectsList of formatted phone numbers.
[{...}].scriptStringName of the script used for the name, in ISO 15924 format.Script
[{...}].idStringProvided unique identifier.
[{...}].firstNameStringSubmitted first name (or given name).
[{...}].lastNameStringSubmitted last name (or family name).
[{...}].internationalPhoneNumberVerifiedStringPositively verified phone number, in E.164 format (according to LibPhoneNumber).
[{...}].phoneCountryIso2VerifiedStringPositively verified country of origin of the phone number, in ISO 3166-1 alpha-2 format (according to LibPhoneNumber).Country of residence
[{...}].phoneCountryCodeNumberMost likely country calling code.Phone prefix
[{...}].phoneCountryCodeAltNumberSecond most likely country calling code.Phone prefix
[{...}].phoneCountryIso2StringMost likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
[{...}].phoneCountryIso2AltStringSecond most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
[{...}].originCountryIso2StringMost likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
[{...}].originCountryIso2AltStringSecond most likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
[{...}].phoneNumberStringSubmitted phone number.
[{...}].verifiedBooleanIndicates if the phone number could be positively verified using LibPhoneNumber.
[{...}].scoreNumberHigher implies a more reliable result, score is not normalized.

Code sample:

Format Phone Number Geo code sample for shell:

curl --request POST \ 
--url https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeoBatch \
--header 'X-API-KEY: your-api-key' \
--header 'Accept: application/json'
--header 'Content-Type: application/json' \
--data '{"personalNamesWithPhoneNumbers":[{"id":"e630dda5-13b3-42c5-8f1d-648aa8a21c42","firstName":"Teniola","lastName":"Apata","phoneNumber":"08186472651","countryIso2":"NG","countryIso2Alt":"CI"}]}'

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Teniola",
      "lastName": "Apata",
      "phoneNumber": "08186472651",
      "countryIso2": "NG",
      "countryIso2Alt": "CI"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Teniola",
            "lastName": "Apata",
            "internationalPhoneNumberVerified": "+234 818 647 2651",
            "phoneCountryIso2Verified": "NG",
            "phoneCountryCode": 234,
            "phoneCountryCodeAlt": 62,
            "phoneCountryIso2": "NG",
            "phoneCountryIso2Alt": "ID",
            "originCountryIso2": "NG",
            "originCountryIso2Alt": "CI",
            "phoneNumber": "08186472651",
            "verified": true,
            "score": 2.362918055640346
        }
    ]
}

Format Phone Number Geo code sample for java:

HttpResponse<String> response = Unirest.post("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeoBatch")
.header("X-API-KEY", "your-api-key")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body("{\"personalNamesWithPhoneNumbers\":[{\"id\":\"e630dda5-13b3-42c5-8f1d-648aa8a21c42\",\"firstName\":\"Teniola\",\"lastName\":\"Apata\",\"phoneNumber\":\"08186472651\",\"countryIso2\":\"NG\",\"countryIso2Alt\":\"CI\"}]}")
.asString();

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Teniola",
      "lastName": "Apata",
      "phoneNumber": "08186472651",
      "countryIso2": "NG",
      "countryIso2Alt": "CI"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Teniola",
            "lastName": "Apata",
            "internationalPhoneNumberVerified": "+234 818 647 2651",
            "phoneCountryIso2Verified": "NG",
            "phoneCountryCode": 234,
            "phoneCountryCodeAlt": 62,
            "phoneCountryIso2": "NG",
            "phoneCountryIso2Alt": "ID",
            "originCountryIso2": "NG",
            "originCountryIso2Alt": "CI",
            "phoneNumber": "08186472651",
            "verified": true,
            "score": 2.362918055640346
        }
    ]
}

Format Phone Number Geo code sample for python:

import requests

url = "https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeoBatch"

payload = {
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Teniola",
      "lastName": "Apata",
      "phoneNumber": "08186472651",
      "countryIso2": "NG",
      "countryIso2Alt": "CI"
    }
  ]
}
headers = {
    "X-API-KEY": "your-api-key",
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Teniola",
      "lastName": "Apata",
      "phoneNumber": "08186472651",
      "countryIso2": "NG",
      "countryIso2Alt": "CI"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Teniola",
            "lastName": "Apata",
            "internationalPhoneNumberVerified": "+234 818 647 2651",
            "phoneCountryIso2Verified": "NG",
            "phoneCountryCode": 234,
            "phoneCountryCodeAlt": 62,
            "phoneCountryIso2": "NG",
            "phoneCountryIso2Alt": "ID",
            "originCountryIso2": "NG",
            "originCountryIso2Alt": "CI",
            "phoneNumber": "08186472651",
            "verified": true,
            "score": 2.362918055640346
        }
    ]
}

Format Phone Number Geo code sample for javascript:

const response = await fetch("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeoBatch", {
  "method": "POST",
  "headers": {
    "X-API-KEY": "your-api-key",
    "Accept": "application/json",
    "Content-Type": "application/json"
  },
  "body": JSON.stringify({
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Teniola",
      "lastName": "Apata",
      "phoneNumber": "08186472651",
      "countryIso2": "NG",
      "countryIso2Alt": "CI"
    }
  ]
})
});

if (response.ok) {
  const data = await response.json(); // Extract JSON data from response
  console.log(data); // View data in the console
} else {
  console.error("The request failed with status:", response.status, response);
}

Body parameter:

{
  "personalNamesWithPhoneNumbers": [
    {
      "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
      "firstName": "Teniola",
      "lastName": "Apata",
      "phoneNumber": "08186472651",
      "countryIso2": "NG",
      "countryIso2Alt": "CI"
    }
  ]
}

The above command returns JSON structured like this:

{
    "personalNamesWithPhoneNumbers": [
        {
            "script": "LATIN",
            "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
            "firstName": "Teniola",
            "lastName": "Apata",
            "internationalPhoneNumberVerified": "+234 818 647 2651",
            "phoneCountryIso2Verified": "NG",
            "phoneCountryCode": 234,
            "phoneCountryCodeAlt": 62,
            "phoneCountryIso2": "NG",
            "phoneCountryIso2Alt": "ID",
            "originCountryIso2": "NG",
            "originCountryIso2Alt": "CI",
            "phoneNumber": "08186472651",
            "verified": true,
            "score": 2.362918055640346
        }
    ]
}
  • Precision:Precision gauge
  • Cost: 11 credits per name.
  • Description: Returns the most likely phone prefix and format of a phone number using a first name, last name and geographic context.
information

For requests with a GET method all parameters are required. For more ease in the use of our requests we recommend that you use the POST method.

HTTP request

http request
GET
https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeo/{firstName}/{lastName}/{phoneNumber}/{countryIso2}
Request header
PropertyRequiredDescription
X-API-KEYRequiredYour Namsor's services API key
information

To get an API key for free, please create an account.

Request parameters
NameTypeRequiredDescription
firstNameStringRequiredFirst name (or given name).
lastNameStringRequiredLast name (or family name).
phoneNumberStringRequiredPhone number, formatted or unformatted.
countryIso2StringRequiredMost likely country of residence, in ISO 3166-1 alpha-2 format.
countryIso2AltStringRequiredSecond most likely country of residence, in ISO 3166-1 alpha-2 format.
Response
NameTypeDescriptionEnumerators
scriptStringName of the script used for the name, in ISO 15924 format.Script
idStringProvided unique identifier.
firstNameStringSubmitted first name (or given name).
lastNameStringSubmitted last name (or family name).
internationalPhoneNumberVerifiedStringPositively verified phone number, in E.164 format (according to LibPhoneNumber).
phoneCountryIso2VerifiedStringPositively verified country of origin of the phone number, in ISO 3166-1 alpha-2 format (according to LibPhoneNumber).Country of residence
phoneCountryCodeNumberMost likely country calling code.Phone prefix
phoneCountryCodeAltNumberSecond most likely country calling code.Phone prefix
phoneCountryIso2StringMost likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
phoneCountryIso2AltStringSecond most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format.Country of residence
originCountryIso2StringMost likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
originCountryIso2AltStringSecond most likely country of residence of the name, in ISO 3166-1 alpha-2 format.Country of origin
phoneNumberStringSubmitted phone number.
verifiedBooleanIndicates if the phone number could be positively verified using LibPhoneNumber.
scoreNumberHigher implies a more reliable result, score is not normalized.

Code sample:

Format Phone Number Geo code sample for shell:

curl --request GET \ 
--url https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeo/Teniola/Apata/08186472651/NG \
--header 'X-API-KEY: your-api-key' \
--header 'Accept: application/json'

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Teniola",
    "lastName": "Apata",
    "internationalPhoneNumberVerified": "+234 818 647 2651",
    "phoneCountryIso2Verified": "NG",
    "phoneCountryCode": 234,
    "phoneCountryCodeAlt": 62,
    "phoneCountryIso2": "NG",
    "phoneCountryIso2Alt": "ID",
    "originCountryIso2": "NG",
    "originCountryIso2Alt": "CI",
    "phoneNumber": "08186472651",
    "verified": true,
    "score": 2.362918055640346
}

Format Phone Number Geo code sample for java:

HttpResponse<String> response = Unirest.get("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeo/Teniola/Apata/08186472651/NG")
.header("X-API-KEY", "your-api-key")
.header("Accept", "application/json")
.asString();

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Teniola",
    "lastName": "Apata",
    "internationalPhoneNumberVerified": "+234 818 647 2651",
    "phoneCountryIso2Verified": "NG",
    "phoneCountryCode": 234,
    "phoneCountryCodeAlt": 62,
    "phoneCountryIso2": "NG",
    "phoneCountryIso2Alt": "ID",
    "originCountryIso2": "NG",
    "originCountryIso2Alt": "CI",
    "phoneNumber": "08186472651",
    "verified": true,
    "score": 2.362918055640346
}

Format Phone Number Geo code sample for python:

import requests

url = "https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeo/Teniola/Apata/08186472651/NG"

headers = {
  "X-API-KEY": "your-api-key",
 "Accept": "application/json"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Teniola",
    "lastName": "Apata",
    "internationalPhoneNumberVerified": "+234 818 647 2651",
    "phoneCountryIso2Verified": "NG",
    "phoneCountryCode": 234,
    "phoneCountryCodeAlt": 62,
    "phoneCountryIso2": "NG",
    "phoneCountryIso2Alt": "ID",
    "originCountryIso2": "NG",
    "originCountryIso2Alt": "CI",
    "phoneNumber": "08186472651",
    "verified": true,
    "score": 2.362918055640346
}

Format Phone Number Geo code sample for javascript:

const response = await fetch("https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeo/Teniola/Apata/08186472651/NG", {
  "method": "GET",
  "headers": {
    "X-API-KEY": "your-api-key",
    "Accept": "application/json"
  }
});

if (response.ok) {
  const data = await response.json(); // Extract JSON data from response
  console.log(data); // View data in the console
} else {
  console.error("The request failed with status:", response.status, response);
}

The above command returns JSON structured like this:

{
    "script": "LATIN",
    "id": "e630dda5-13b3-42c5-8f1d-648aa8a21c42",
    "firstName": "Teniola",
    "lastName": "Apata",
    "internationalPhoneNumberVerified": "+234 818 647 2651",
    "phoneCountryIso2Verified": "NG",
    "phoneCountryCode": 234,
    "phoneCountryCodeAlt": 62,
    "phoneCountryIso2": "NG",
    "phoneCountryIso2Alt": "ID",
    "originCountryIso2": "NG",
    "originCountryIso2Alt": "CI",
    "phoneNumber": "08186472651",
    "verified": true,
    "score": 2.362918055640346
}