POST API Lookup

This API is best suited when you want to query lookup details for multiple phone numbers. This API will give you a unique Lookup ID for each number queried. You can use the Lookup ID to perform a comprehensive lookup for the phone number.

1. Sign up for free

Before you get started, sign up in Kaleyra.io for free and create an API key.

2. POST API Lookup

curl -X POST "https://api.kaleyra.io/v1/<SID>/lookup" \
     -H "Content-Type: <CONTENT_TYPE>" \
     -H "api-key: <API_KEY>" \
     --data-raw "{"mobile" : 
                    [
                      "<PHONE_NUMBER>",
                      "<PHONE_NUMBER>",
                      "<PHONE_NUMBER>",
                      "<PHONE_NUMBER>",
                      "<PHONE_NUMBER>",
                      "<PHONE_NUMBER>"
                    ]
                 }"

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

Replace

With

Examples

Mandatory?

SID

Account SID (Security Identifier). Generated by Kaleyra.io while creating an API key.

HXXXXXXX071US

True

CONTENT_TYPE

Indicates the format of the content the API will be processing.

application/json'

True

API_KEY

Your API Key generated by Kaleyra.io.
Example: Ac4XXXXX21f

Ac4XXXXX21f

True

PHONE_NUMBER

The phone numbers 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

3. View Response

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

{
    "data": {
        "code": "LKP201",
        "message": "Request accepted successfully",
        "id": "2020-01-XXAXXXdXXXXXXXXbbaXXXXeaXecXXXcd4cX3fXXbXXcc",
        "total_processed_count": 6,
        "data": [
            {
                "lookup_id": "XXXXadc-cXeX-XXXX-XcXX-XXXXXXdbXXXX:X",
                "mobile_number": "9190XXXXXX",
                "url": "https://api.{pod}.kaleyra.io/api/v1/AXXXdXXXXX/lookup/get-info/XXXXbadc-cXe0-XXXX-XcXX-XXXXXXdbXXXX:X"
            },
            {
                "lookup_id": "XXXXadc-cXeX-XXXX-XcXX-XXXXXXdbXXXX:X",
                "mobile_number": "9190XXXXXX",
                "url": "https://api.{pod}.kaleyra.io/api/v1/AXXXdXXXXX/lookup/get-info/XXXXbadc-cXe0-XXXX-XcXX-XXXXXXdbXXXX:X"
            },
            {
                "lookup_id": "XXXXadc-cXeX-XXXX-XcXX-XXXXXXdbXXXX:X",
                "mobile_number": "9190XXXXXX",
                "url": "https://api.{pod}.kaleyra.io/api/v1/AXXXdXXXXX/lookup/get-info/XXXXbadc-cXe0-XXXX-XcXX-XXXXXXdbXXXX:X"
            },
            {
                "XXXXadc-cXeX-XXXX-XcXX-XXXXXXdbXXXX:X",
                "mobile_number": "9190XXXXXX",
                "url": "https://api.{pod}.kaleyra.io/api/v1/A657d34237/lookup/get-info/XXXXbadc-cXe0-XXXX-XcXX-XXXXXXdbXXXX:X"
            },
            {
                "lookup_id": "XXXXadc-cXeX-XXXX-XcXX-XXXXXXdbXXXX:X",
                "mobile_number": "9190XXXXXX",
                "url": "https://api.{pod}.kaleyra.io/api/v1/AXXXdXXXXX/lookup/get-info/XXXXbadc-cXe0-XXXX-XcXX-XXXXXXdbXXXX:X"
            },
            {
                "lookup_id": "XXXXadc-cXeX-XXXX-XcXX-XXXXXXdbXXXX:X",
                "mobile_number": "9190XXXXXX",
                "url": "https://api.{pod}.kaleyra.io/api/v1/AXXXdXXXXX/lookup/get-info/XXXXbadc-cXe0-XXXX-XcXX-XXXXXXdbXXXX:X"
            }
        ],
        "invalid_count": 0,
        "duplicate_count": 0
    },
    "error": {}
}

📘

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.


Did this page help you?