Get Blocklist

GET Method

The Get Blocklist API allows you to fetch the blocklisted status of numbers up to 100.

Base URL

<https://api.kaleyra.io/v1/><SID>

To fetch the blocklisted status of numbers, perform the following steps:

  1. Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
  2. Fetch the blocklisted status of numbers in the API request.

API request to fetch the blocklisted status of numbers

To fetch the blocklisted status of numbers, use the /contacts/blocklisted endpoint with the following request method:

Request Format

The following is the request format to fetch the blocklisted status of numbers.

curl -X GET 'https://api.kaleyra.io/v1/<SID>/contacts/blocklisted?limit=<limit>&offset=<offset>&channel=<channel_name>&mobile=<mobile_numbers>'\
--header 'api-key:  <api_key>' \

Sample Request Format

The following is the sample request format to fetch the blocklisted status of numbers.

curl -X GET 'https://api.kaleyra.io/v1/HXXXXXXX071US/contacts/blocklisted?limit=3&offset=0&channel=whatsapp&mobile=+91802XXXXX52%2C+91803XXXXX53'\
--header 'api-key: A522b7e64XXXXXXXXf7d99b03545fa68e'

πŸ“˜

Note:

You can send the request for a maximum set of 100 phone numbers.

Parameter and Data Types

The following table shows the list of parameters and data types supported:

ParameterData TypeDescriptionExamplesMandatory
sidStringAccount SID (Security Identifier).HXXXXXXX071USYes
api-keyStringYour API Key generated by kaleyra.io.A522b7e64XXXXXXXXf7d99b03545fa68eYes
limitIntegerSpecifies the number of elements returned in the response.β€―
Note: It is not possible to retrieve more than 100 contacts per response. By default, the limit is set to 100.
3No
offsetIntegerPosition in the dataset of a particular record. By specifying offset, you retrieve a subset of records starting with the offset value. By default, offset is set to 0 (which returns result for the first 100 contacts found).0No
channel_nameStringChannel for which the contacts are blocklisted. The acceptable value is "sms", "whatsapp", and "voice".smsOptional
mobile_numbersStringA valid phone number. Ensure that the country code is prefixed to the number. (E164 format).
Note:
a. You can add multiple recipients, separate each number using the comma (,) delimiter.
b. In case mobile numbers is not included in the API request, the complete blocklist numbers will be provided with a limit of 100.
+91802XXXXX52, +91803XXXXX53Optional

Sample Success Response

The following success message appears with the status 200 succeeded.

{ 

    "code": "CNT196", 

    "message": "Successfully fetched blocklisted number(s)", 

    "data": [ 

        { 

            "mobile": "+91802XXXXX52", 

            "channel_type": "3" 

        } 

    ], 

    "error": {} 

} 

πŸ“˜

Note:

The response will only contain the blocklisted numbers and their respective channels. For example, if multiple numbers are provided, then only the blocklisted numbers will be shown and if none of the numbers are blocklisted, then empty array will be returned.

Sample Failure Response

The following is a sample failure response.

{ 

    "code": "CNT195", 

    "message": "Unable to fetch the blocklisted number", 

    "data": [], 

    "error": { 

        "description": "Unable to fetch the blocklisted number" 

    } 

}