HLR Lookup API for phone number validation

In this article you will learn how to use the HLR Lookup API to validate phone numbers in real time. You will see how to perform individual validations, mass validations through files and how to automate the processes to create a number validator through the API. We will see several code examples, focusing on some languages such as PHP and JavaScript. Finally we will see how to use the phone number verification API documentation.

What is a REST API?

(Application Programming Interface Representational State Transfer) is a form of communication between systems using HTTP conventions. Imagine it is a messenger that carries requests and responses between your application and a server. REST APIs are widely used due to their simplicity and efficiency.

Main components of a REST API

  1. Resources
    They represent data, such as users or products.

  2. HTTP Verbs
    Methods such as GET, POST, PUT and DELETE to interact with resources.

  3. Endpoints
    URLs indicating where a specific resource is located.

  4. Data Format
    Usually JSON or XML.

Practical Example: Phone Number Verification with HLR Lookup

Phone number verification using
HLR Lookup
(Home Location Register Lookup) allows you to know if a number is valid and active. This is useful for companies that want to ensure that their messages reach the right recipients.

Verification process

  1. You send a request
    with the phone number to the HLR Lookup API.

  2. The validation API queries
    the HLR database of the telephone operator.

  3. You receive a response
    indicating the status of the phone number.

Step-by-step implementation using the verificaremails.com API

  1. Register
    at verificaremails.com and get your API key.

  2. Sends a GET request
    request to the HLR Lookup validation API.
curl -X GET "https://www.verificaremails.com/api/v1/hlr?phone_number=1234567890" 
-H "apikey: TU_CLAVE_API"

  1. Interpret the answer
    . An example of a response might be:
"status": "success",
"data": {
"phone_number": "1234567890",
"valid": true,
"carrier": "Movistar",
"country": "ES"

We can get more information about the phone number in particular if it is a mobile number in the JSON file of the response.

Response format

If we go into detail, apart from indicating whether the number is valid or invalid, we can obtain information about the telephone operator, the type of line, the international format of the number… If you want to know if the number is valid you should look at the IMSI, MCC, MNC and MCCMNC fields. All these checks are performed by the validation api and displayed in the value of the “reachable” field.


(International Mobile Subscriber Identity) is a unique number associated with each mobile network user. This number is stored on the SIM card and is used by mobile networks to identify subscribers.

IMSI Components

The IMSI is composed of three parts:

  1. MCC (Mobile Country Code)
    Three-digit code that identifies the subscriber’s country.

  2. MNC (Mobile Network Code)
    Two or three digit code that identifies the mobile network within that country.

  3. MSIN (Mobile Subscriber Identification Number)
    Unique number that identifies the subscriber within the mobile network.


  • MCC
    CQI: Each country has a unique CQI. For example, Spain has MCC 214.

  • MNC
    The operators within a country have different MNCs. For example, in Spain, Movistar has MNC 07.


is the combination of the MCC and the MNC. It is used to uniquely identify a mobile network in a country. For example, the MCCMNC for Movistar in Spain would be 21407.

Phone Number Verification

To verify if a phone number is true using the IMSI:

  1. Obtaining the IMSI
    Extract the IMSI from the SIM card of the phone.

  2. Analyze the IMSI
    • Extract the MCC and MNC from the IMSI.
    • Verify that the MCC corresponds to the expected country.
    • Verify that the MNC corresponds to a valid operator in that country.

  3. Validation
    • Check that the MCCMNC exists and is valid.
    • Ensure that the MSIN is correct and active on the network.


If you have an IMSI 214071234567890, you can break it down like this:

  • MCC
    : 214 (Spain)

  • MNC
    : 07 (Movistar)

  • MSIN
    : 1234567890 (Subscriber’s Unique Identifier)

By verifying the MCC and MNC, you can confirm that the phone number belongs to a Movistar subscriber in Spain, which helps validate its authenticity.


“id”: “364215”,

“term”: “34677934019”,

“request_id”: “364215”,

“result_code”: “101”,

“result_type”: “Connected”,

“result”: {

“phone_number”: “+34677934019”,

“number_type”: “mobile”,

“timezone”: “Atlantic/Canary”,

“format”: {

“e164”: “+34677934019”,

“international”: “+34 677 93 40 19”,

“national”: “677 93 40 19”,

“rfc3966”: “tel:+34-677-93-40-19”


“is_ported”: true,

“reachable”: “connected”,

“processing_status”: “completed”,

“imsi”: “214040000000000”,

“current_network”: {

“country_iso2”: “EN”,

“country_prefix”: “34”,

“country_name”: “Spain”,

“mccmnc”: “21404”,

“mcc”: “214”,

“mnc”: “04”,

“area”: “ES”,

“network_name”: “Yoigo”.


“original_network”: {

“country_iso2”: “EN”,

“country_prefix”: “34”,

“country_name”: “Spain”,

“mccmnc”: “21401”,

“mcc”: “214”,

“mnc”: “01”,

“area”: “ES”,

“network_name”: “Vodafone”.




How to create a telephone number validator with PHP

To facilitate the use of the phone validator in your forms and applications, we have created a POSTMAN library where you can download the api calls as well as code examples. In the case of our example, if we want to make a call in PHP, we must select this language within the Postman collection and the application itself will generate the PHP call to validate a phone number.

validate phone number in php

Why validate phone numbers

Capturing leads is expensive and will become more so every day. It is estimated that between 8-12% of the telephones captured on forms or during registration processes are erroneous. Data verification at the point of capture allows these errors to be detected and registration rates to be improved.

Once the lead is captured, it enters a “sales funnel” for its exploitation. If the phone number is wrong, we will be allocating resources that will never get a return. Our advice is to verify all phone numbers at the point of acquisition, but if you haven’t done so, at least verify the database to get a true picture of your potential customers.


We have seen the different ways to validate phone numbers. We have seen that this service is indicated for the verification of mobile numbers during the registration process, improving the quality of the data and avoiding the capture of invalid numbers. Remember that you can apply HLR Lookup validation to individual phones, massively to files with a high volume of numbers or automating the process with the number validation API.

We recommend that you review the validation API documentation for the different phone calls and if you want to have access to the validation libraries in the different programming languages. Although the API calls are Rest, it will always make it easier for you to integrate the service.