Get List of Blocked WhatsApp User Numbers
GET Method
The Get List of Blocked WhatsApp User Numbers API allows you to get the list of blocked WhatsApp user numbers that have been blocked for a particular business number.
Prerequisites
- Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID. A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on Kaleyra platform.
- To set up a WhatsApp account on Kaleyra platform, see Manual Signup and Embedded Signup.
- An active WhatsApp plan for Business API that includes:
- A WhatsApp business number.
- An associated profile with the business number.
- A WhatsApp verified and approved profile.
Note:
If you are using WhatsApp V1 version, use
https://<api_domain>/v1/<SID>endpoint.
API Domain and Value
| api_domain | Value |
|---|---|
| IN pod | api.in.kaleyra.io |
| SG Pod | api.ap.kaleyra.io |
| EU Pod | api.eu.kaleyra.io |
| NA pod | api.na.kaleyra.ai |
API request to Get List of Blocked WhatsApp User Numbers
To get list of blocked WhatsApp user numbers, use:
https://<api_domain>/v2/<sid>/whatsapp/<phone_number>/block_users
endpoint with the following request method.
The following is the request format to get the list of blocked WhatsApp user numbers:
curl --location --request GET 'https://<api_domain>/v2/<sid>/whatsapp/<phone_number>/block_users?limit=<limit>&before=<before>&after=<after>' \
-H 'api-key: <api-key>'The following is the sample request format to get the list of blocked WhatsApp user numbers:
curl --location --request GET 'https://<api_domain>/v2/HXAP16XXXXXX97IN/whatsapp/+9194070XXXXX/block_users?limit=10&before=NDMyNzQyXXXXXXX&after=MTANTEOTQ1MXXXXXXXXXX' \
-H 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3'URL Parameters and Headers
The following is the list of parameters and headers to get the list of blocked WhatsApp user numbers:
Parameter / Headers | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
| String | Account SID (Security Identifier). | HXAP16XXXXXX97IN | Yes |
| String | Indicates the WhatsApp Business phone number for which you want to get the list of blocked users. | +9194070XXXXX | Yes |
| Integer | Maximum number of blocked users to fetch in the response. The default value is set to 25. | 10 | Optional |
| String | This is the cursor that points to the start of the page of data that has been returned. | NDMyNzQyXXXXXXXX | Optional |
| String | This is the cursor that points to the end of the page of data that has been returned. | MTANTEOTQ1MXXXXXXXXXX | Optional |
| String | API key generated from Kaleyra account. | Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3 | Yes |
Sample Success Response
If all the passed user mobile number are added to the blocklist, the following success message is returned with the status 200 Accepted:
{
"code": "WA200",
"message": "Request Processed Successfully",
"data": [ {
"messaging_product": "whatsapp",
"wa_id": "919408XXXXXX"
},
{
"messaging_product": "whatsapp",
"wa_id": "918074XXXXXX"
}
],
"paging": {
"cursors": {
"before": "NDMyNzQyXXXXXXXX",
"after": "MTANTEOTQ1MXXXXXXXXXX"
}
}
}Response Parameters
The following is the list of parameters shown in the API response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
code | String | The response code for the request sent. | WA200 |
message | String | The message that corresponds to the response code returned by the API. | Request Processed Successfully. |
data | Object | This array shows the details of the returned blocked phone numbers. | See the specific table for details. |
paging | Object | This object shows the pagination of the data. | See the specific table for details. |
Data object Parameters
The following is the list of parameters for Data object in the API response.
| Parameter | Data Type | Description | Example |
|---|---|---|---|
messaging_product | String | The platform being used for messaging. | The only value returned is whatsapp. |
wa_id | String | The phone number of the blocked user. | 919408XXXXXX |
Paging object Parameters
The data returned in the response object would be used for navigating between the previous and the next page.
The following is the list of parameters for paging object in the API response.
| Parameter | Data Type | Description | Example |
|---|---|---|---|
cursors | String | Indicates the pagination details to be used in the API, if required. | See the specific table for details. |
Cursors object Parameters
The following is the list of parameters for cursors object in the API response.
| Parameter | Data Type | Description | Example |
|---|---|---|---|
before | String | This is the cursor that points to the start of the page of data that has been returned. | NDMyNzQyXXXXXXXX |
after | String | This is the cursor that points to the end of the page of data that has been returned. | MTANTEOTQ1MXXXXXXXXXX |
Sample Failure Responses
The following are the failure responses:
WhatsApp Phone Number Check
401 Unauthorized Phone Number Status
{
"code": "WA401",
"message": "The phone number you're using not active",
"data": {},
"error": {
"phone_number": "The phone number you're using not active"
}
}401 Unauthorized Phone number
{
"code": "WA401",
"message": "Phone number is not present or does not belong to the account.",
"data": {},
"error": {
"phone_number": "Phone number is not present or does not belong to the account."
}
}API Key and SID validations
401 Unauthorized
{
"code": "RBC001",
"message": "Incorrect SID or API key.",
"data": [],
"error": {
"error": "Incorrect SID or API key."
}
}Payload Validations
400 Incorrect payload
{
"code": "WA400",
"message": "Refer to correct payload format",
"data": {},
"error": {
"payload": "Incorrect payload format"
}
}Internal Server Errors
500 Internal Server Error
{
"code": "WA500",
"message": "Please try again later",
"data": {},
"error": {
"error": "Internal server error"
}
}For more information on the Block Users Error Codes, see Block Users Error Codes page.
Updated 1 day ago
