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:
- 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

https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeBatch
Property | Required | Description |
---|---|---|
X-API-KEY | Required | Your Namsor's services API key |

To get an API key for free, please create an account.
Name | Type | Required | Description |
---|---|---|---|
personalNamesWithPhoneNumbers | Array of objects | Required | A list of personal names with phone numbers. |
[{...}].id | String | Optional | Unique identifier. |
[{...}].firstName | String | Optional | First name (or given name). |
[{...}].lastName | String | Optional | Last name (or family name). |
[{...}].phoneNumber | String | Required | Phone number, formatted or unformatted. |
Name | Type | Description | Enumerators |
---|---|---|---|
personalNamesWithPhoneNumbers | Array of objects | List of formatted phone numbers. | |
[{...}].script | String | Name of the script used for the name, in ISO 15924 format. | Script |
[{...}].id | String | Provided unique identifier. | |
[{...}].firstName | String | Submitted first name (or given name). | |
[{...}].lastName | String | Submitted last name (or family name). | |
[{...}].internationalPhoneNumberVerified | String | Positively verified phone number, in E.164 format (according to LibPhoneNumber). | |
[{...}].phoneCountryIso2Verified | String | Positively verified country of origin of the phone number, in ISO 3166-1 alpha-2 format (according to LibPhoneNumber). | Country of residence |
[{...}].phoneCountryCode | Number | Most likely country calling code. | Phone prefix |
[{...}].phoneCountryCodeAlt | Number | Second most likely country calling code. | Phone prefix |
[{...}].phoneCountryIso2 | String | Most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format. | Country of residence |
[{...}].phoneCountryIso2Alt | String | Second most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format. | Country of residence |
[{...}].originCountryIso2 | String | Most likely country of residence of the name, in ISO 3166-1 alpha-2 format. | Country of origin |
[{...}].originCountryIso2Alt | String | Second most likely country of residence of the name, in ISO 3166-1 alpha-2 format. | Country of origin |
[{...}].phoneNumber | String | Submitted phone number. | |
[{...}].verified | Boolean | Indicates if the phone number could be positively verified using LibPhoneNumber. | |
[{...}].score | Number | Higher 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 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:
- 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

https://v2.namsor.com/NamSorAPIv2/api2/json/phoneCodeGeoBatch
Property | Required | Description |
---|---|---|
X-API-KEY | Required | Your Namsor's services API key |

To get an API key for free, please create an account.
Name | Type | Required | Description |
---|---|---|---|
personalNamesWithPhoneNumbers | Array of objects | Required | A list of personal names with phone numbers and their local context. |
[{...}].id | String | Optional | Unique identifier. |
[{...}].firstName | String | Optional | First name (or given name). |
[{...}].lastName | String | Optional | Last name (or family name). |
[{...}].phoneNumber | String | Required | Phone number, formatted or unformatted. |
[{...}].countryIso2 | String | Required | Most likely country of residence, in ISO 3166-1 alpha-2 format. |
[{...}].countryIso2Alt | String | Optional | Second most likely country of residence, in ISO 3166-1 alpha-2 format. |
Name | Type | Description | Enumerators |
---|---|---|---|
personalNamesWithPhoneNumbers | Array of objects | List of formatted phone numbers. | |
[{...}].script | String | Name of the script used for the name, in ISO 15924 format. | Script |
[{...}].id | String | Provided unique identifier. | |
[{...}].firstName | String | Submitted first name (or given name). | |
[{...}].lastName | String | Submitted last name (or family name). | |
[{...}].internationalPhoneNumberVerified | String | Positively verified phone number, in E.164 format (according to LibPhoneNumber). | |
[{...}].phoneCountryIso2Verified | String | Positively verified country of origin of the phone number, in ISO 3166-1 alpha-2 format (according to LibPhoneNumber). | Country of residence |
[{...}].phoneCountryCode | Number | Most likely country calling code. | Phone prefix |
[{...}].phoneCountryCodeAlt | Number | Second most likely country calling code. | Phone prefix |
[{...}].phoneCountryIso2 | String | Most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format. | Country of residence |
[{...}].phoneCountryIso2Alt | String | Second most likely country of origin of the phone number, in ISO 3166-1 alpha-2 format. | Country of residence |
[{...}].originCountryIso2 | String | Most likely country of residence of the name, in ISO 3166-1 alpha-2 format. | Country of origin |
[{...}].originCountryIso2Alt | String | Second most likely country of residence of the name, in ISO 3166-1 alpha-2 format. | Country of origin |
[{...}].phoneNumber | String | Submitted phone number. | |
[{...}].verified | Boolean | Indicates if the phone number could be positively verified using LibPhoneNumber. | |
[{...}].score | Number | Higher 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
}
]
}