What is Number Lookup & how to use it for number validation

The definition of Number Lookup

Number Lookup, also known as HLR (Home Location Register) lookup, is a particular telecommunications service that dynamically contacts a central database (on the operator’s side) that contains details of each mobile phone subscriber authorized to use the GSM core network.

In recent years, number lookup queries have found useful applications in campaigns and programs based on mobile phone numbers. Companies have used them to automatically check validity and status of mobile numbers in their databases, which allowed them to optimize different processes and reduce costs.

IMSI = MCC+MNC+MSIN and has 15 digits

Every phone number contains information that differentiates it from any other phone number in the world. First there is IMSI (International Mobile Subscriber Identity), a fifteen-digit number that carries the information about MCC (Mobile country code), MNC (Mobile network code) and MSIN (Mobile Subscription Identification number).

The first three digits in IMSI are the number’s country code (for Croatia this is 219). The second two numbers are 01, and they identify the network, in this case T-Mobile Croatia. The last ten digits go, they describe the MSIN, a 10-digit unique number that any carrier uses to identify the user’s mobile phone.

Secondly, what Number Lookup helps with is MNP (mobile number portability), i.e. whether a mobile number is ported or not. It’s not unusual that a subscriber of one mobile network operator transfers to another operator but keeps the old number. That’s a common occurrence in almost every country in the world.

Thirdly, Number Lookup also helps you understand if a phone number is in roaming. This can be of crucial importance when you try to protect your clients and prevent fraudulent actions towards their account.

Number Lookup: Sync vs. Async

There are two ways to perform a successful Number Lookup. One is synchronous, performed over HTTP API when a client sends a single or multiple number lookup query. The important thing with this type of Lookup is that with it, if you make multiple number lookups you’ll have to wait until every single Lookup is completed. Sometimes, if there is a list of numbers needed to be checked, it can lead to a queue.

On the other hand, asynchronous Number Lookup, done over a dedicated notifyURL set by a client works differently. With it, you can send as many requests as you want, without having to wait for them all to be completed. You’ll get a notification on your notifyURL as soon as we receive it. Depending on the operator, you’ll receive the entire bulk list all at once and sometimes it’s possible to receive every number by itself. This can be rather convenient if you have a large phone number database or multiple databases.

Save response time

The response you receive by looking up numbers with synchronous REST HTTP API is sent after each request, regardless of it being single or bulk. Although the response should be visible in just a couple of seconds, the period between sending a request and receiving a response can be prolonged by various issues. For example, mobile operators have a limited number of requests that can be processed in a fixed time period. This makes the response delivery slower, as you need to wait for the query of the last number to be processed before you can receive a response for the entire Lookup request.

With asynchronous API that speed is improved because you’re able to receive a real time notification. What is different in this case (other than speed) is that this version is a bit more complicated to integrate as the call-back server is required on the client’s side to parse the response with the particular request. Here, security is of the utmost importance – our clients are advised to set up a secure firewall for data protection.

The most frequent use cases are:

checking for active/inactive numbers providing the info about the numbers in roaming checking mobile number portability status finding the optimal route for SMS and Voice messages the type of number (e.g. land-line, machine-to-machine, mobile etc.)

In Infobip we have three main packages available, so you can choose the one that best fits your business:

Database Cleaning: Designed for companies with vast number databases, our Database Cleaning package enables identifying unused and inactive numbers. Portability: Developed to resolve number portability issues for various company types, this package enables real-time number portability lookups to optimize message and voice routing. It includes all the features of the Database Cleaning package. Roaming: Primarily created to serve the financial client segment, the package provides roaming information for optimized routing, prevention of ATM frauds and much more.

With the help of Number Lookup you’ll get a better insight into your user database, their behavior, check the phone number’s format to avoid unwanted wrong phone numbers.

After sending promotional messages to your customers and analyzing the delivery reports, sometimes you’ll see the large difference between user data and the number of delivered messages. To prevent unnecessary waste of your money it is advisable to check / clean your database before sending any of your campaigns. Improving the accuracy and cost effectiveness of mobile initiatives is key when you have a large user database, because it saves you more money.

Number Lookup can help you to better understand your customers. See when they are traveling and offer them customized services.

How does Number Lookup work?

The following example shows how you can get Number Lookup information using our API:


The ‘to’ parameter is a list of all the numbers you want to check.

Here is your result:


As we already said, there is a major difference between sync and async types of Number Lookup. We will guide you through both of them, over each line of code. If an API call is synchronous, Number lookup will be done before the app receives the response from an API call.This means that the application code should properly handle waiting for an HTTP response so users don’t perceive waiting for Number Lookup response as latency or performance lag inside your app. Making a synchronous API call can be beneficial if there is a code in your app that will only execute properly once the API response is received.

Here is an example of sending a sync multiple phone numbers request:


And the response will be:


For more code examples of a synchronous Number Lookup visit our developer web hub.

Unlike the synchronous calls, asynchronous calls do not wait for the Number Lookup to be done with the entire bulk query before a call response is returned. When a lookup query for any of numbers is done, a “callback” function is executed, and Number Lookup information is sent to the notifyUrl you specified in the request.

Here is an example of sending an async multiple phone numbers request:


With the notification:

Note that in this example you can receive just one notification but also you can receive a notification for each number individually.

Your mobile subscribers often change numbers, go into roaming and change providers while retaining their original phone number. Knowing which mobile numbers are in use and available, or which network your client is currently using can greatly improve accuracy and cost effectiveness for many types of businesses. Hopefully, this blog helped you maintain a cleaner database and helped you reach your users.

Nov 3rd, 2016
6 min read