The Block Users API enables your business to block bad actors from contacting you.
When you block a WhatsApp user, the following happens:
Errors on the API occur per-number since blocks might be successful on some numbers and not others.
The Block Users API is synchronous.
The API contains 3 endpoints:
// Block WhatsApp user numbers POST /<PHONE_NUMBER_ID>/block_users
// Unblock WhatsApp user numbers DELETE /<PHONE_NUMBER_ID>/block_users
// Get list of blocked WhatsApp user numbers GET /<PHONE_NUMBER_ID>/block_users
Use this endpoint to block a list of WhatsApp user numbers.
POST /<PHONE_NUMBER_ID>/block_users
{
"messaging_product": "whatsapp",
// List of WhatsApp user numbers to be blocked
"block_users": [
{
"user": "<PHONE_NUMBER> or <WA_ID>"
}
]
}| Parameter | Description |
|---|---|
String | Required Messaging service used for the request. Must be |
Object | Required List of user(s) to block. Each element contains a |
string | The phone number or WhatsApp ID to be blocked. |
SUCCESS (200)
{
"messaging_product": "whatsapp",
"block_users": {
"added_users": [
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
}
]
}
}| Parameter | Description |
|---|---|
Object | Contains two lists:
|
Object | List of successfully blocked users. Contains values of both:
|
Object | List of users failed to be blocked Contains values of both:
|
MIXED SUCCESS/FAILURE (400)
{
"messaging_product": "whatsapp",
"block_users": {
"added_users": [
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
},
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
},
...
],
"failed_users": [
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
},
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
},
...
"errors": [{
"message": "<MESSAGE>",
"code": "<CODE>",
"error_data": {
"details": "<DETAILS>""
}]
}
}
]
},
"error": {
"message": "(#139100) Failed to block/unblock users",
"type": "OAuthException",
"code": 139100,
"error_data": {
"details": "Failed to block some users, see the block_users response list for details"
},
"fbtrace_id": "<FBTRACE_ID>"
}
}Use this endpoint to unblock a list of WhatsApp user numbers.
DELETE /<PHONE_NUMBER_ID>/block_users
{
"messaging_product": "whatsapp",
"block_users": [
{
// List of WhatsApp user numbers to be unblocked
"user": "<PHONE_NUMBER> or <WA_ID>"
}
]
}| Parameter | Description |
|---|---|
String | Required Messaging service used for the request. Must be Cloud API only. |
Object | Required List of user(s) to block. Each element contains a |
string | The phone number or WhatsApp ID to be blocked. |
SUCCESS (200)
{
"messaging_product": "whatsapp",
"block_users": {
"added_users": [
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
}
]
}
}| Parameter | Description |
|---|---|
Object | Contains two lists:
|
Object | List of successfully blocked users. Contains values of both:
|
Object | List of users failed to be blocked Contains values of both:
|
MIXED SUCCESS/FAILURE (400)
{
"messaging_product": "whatsapp",
"block_users": {
"added_users": [
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
},
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
},
...
],
"failed_users": [
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
},
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
}
...
"errors": [{
"message": "<MESSAGE>",
"code": "<CODE>",
"error_data": {
"details": "<DETAILS>""
}]
}
}
]
},
"error": {
"message": "(#139100) Failed to block/unblock users",
"type": "OAuthException",
"code": 139100,
"error_data": {
"details": "Failed to block some users, see the block_users response list for details"
},
"fbtrace_id": "<FBTRACE_ID>"
}
}Use this endpoint to get a list of blocked numbers on your WhatsApp Business number.
GET /<PHONE_NUMBER_ID>/block_users
?limit=10, // Optional &after=<AFTER_CURSOR>, // Optional &before=<BEFORE_CURSOR> // Optional
| Parameter | Description |
|---|---|
Optional | Maximum number of blocked users to fetch in the request. |
Optional | Learn more about Paginated Results in Graph API here |
Optional | Learn more about Paginated Results in Graph API here |
SUCCESS
{
"data": [
{
"block_users": [
{
"input": "<PHONE_NUMBER> or <WA_ID>",
"wa_id": "<WA_ID>"
}
]
}
],
"paging": {
"cursors": {
"after": "MTAxNTExOTQ1MjAwNzI5NDE=",
"before": "NDMyNzQyODI3OTQw"
},
"previous": "https://graph.facebook.com/{version}/{phone-number-id}/block_users?limit=10&before=NDMyNzQyODI3OTQw",
"next": "https://graph.facebook.com/{version}/{phone-number-id}/block_users?limit=25&after=MTAxNTExOTQ1MjAwNzI5NDE="
}
}| Parameter | Description |
|---|---|
Object | Required List of user(s) to block. Each element contains a |
String | Phone number of the blocked user |
Object | Learn more about Paginated Results in Graph API here |
ERROR
{
"messaging_product": "whatsapp",
"error": {
"message": "(#135002) Blocklist concurrent update",
"type": "OAuthException",
"code": 139102,
"error_data": {
"messaging_product": "whatsapp",
"details": "Blocklist was updated during retrieval - retry with offset 0"
},
"fbtrace_id": "<FBTRACE_ID>"
}
}| Code | Description |
|---|---|
Failed to block/unblock some users | Bulk blocking failed to block some or all of the users. |
Blocklist limit reached | The blocklist limit is reached when the 64k limit is met. |
Blocklist concurrent update | Occurs when the block list is updated while performing a pagination request and |
Internal error | Internal error, please try again. |
Rate Limit Hit | Occurs when either:
|
Self Block | Failed to block self phone number. |
Re-engagement required | Occurs if the business has not received a message from that number in the last 24 hours. This error will also be returned if the number is an invalid WhatsApp user. |