GET API Lookup

Kaleyra.io offers a simple API that will validate national and international phone numbers for you and perform a lookup of the details of the phone number.

  1. Sign up for free

Before you get started, sign up in Kaleyra Cloud for free and Create an API Key. To view the API Key and the SID, see View API Key and SID.

  1. Get API Lookup

Use the following command:

curl -X GET "https://api.kaleyra.io/v1/<SID>/lookup/<PHONE_NUMBER>" \
     -H 'Content-Type: <CONTENT_TYPE>'\
     -H 'api-key: <API_KEY>'

Replace placeholders above with relevant values as described in the table below:

ReplaceWithExamplesMandatory?
SIDAccount SID (Security Identifier). Generated by Kaleyra.io while creating an API key.HXXXXXXX071USTrue
PHONE_NUMBERThe phone number you want to query. Multiple phone numbers must be separated with a comma.
Note: Ensure that the country code is prefixed to the number. (E164 format).
True
CONTENT_TYPEIndicates the format of the content the API will be processing.application/jsonTrue
API_KEYYour API Key generated by Kaleyra.io.
Example: Ac4XXXXX21f
Ac4XXXXX21fTrue
  1. View Response

As part of the response, this API returns information about the number queried. Details returned show information about the phone number's country, country code, the mobile country code (MCC) details and operator information. For each phone number queried, the API returns a Lookup ID. You can also query details about the phone number with just the Lookup ID using the GET Lookup Details by Lookup ID

{
    "code": "LKP200",
    "message": "Request processed successfully",
    "price": 0.80000000000000004,
    "id": "2019-09-30messagesfXXXdXaXXbdXXXXaXcXaaXXfXfeeXXbX",
    "total_processed_count": 4,
    "data": [
        {
            "lookup_id": "2019-09-30messagesfXXXdXaXXbdXXXXaXcXaaXXfXfeeXXbX:1",
            "mobile_number": "9190XXXXXX",
            "country": "IN",
            "country_code": 91,
            "current_mcc": "404",
            "current_mnc": "70",
            "current_operator": "",
            "original_mcc": "",
            "original_mnc": "",
            "original_operator": "Airtel // Rajasthan",
            "roaming_mcc": "",
            "roaming_mnc": "",
            "roaming_opearator": "",
            "is_ported": 0
        },
        {
            "lookup_id": "2019-09-30messagesfXXXdXaXXbdXXXXaXcXaaXXfXfeeXXbX:2",
            "mobile_number": "9190XXXXXX",
            "country": "IN",
            "country_code": 91,
            "current_mcc": "404",
            "current_mnc": "40",
            "current_operator": "Airtel // Chennai",
            "original_mcc": "",
            "original_mnc": "",
            "original_operator": "Airtel // Chennai",
            "roaming_mcc": "404",
            "roaming_mnc": "40",
            "roaming_opearator": "Airtel // Chennai",
            "is_ported": 0
        }
    ],
    "invalid_count": 0,
    "duplicate_count": 1
}

📘

Note:

In case of an error, ensure that the parameter values are correct in the above code. Refer to the Understand Error Codes page for detailed information.





© 2020-2021 Kaleyra Inc. All rights reserved

Trademarks, logos and service marks displayed on this site are registered and unregistered trademarks of Kaleyra Inc.