Add or reactivate a recipient phone number in the sender blacklist.
Add Number
Summary
Add or reactivate a recipient phone number in the sender blacklist.
Prerequisites
- Authorization: Bearer w91_live_xxx
- Content-Type: application/json for JSON requests
Related documentation
Endpoint: POST /api/v2/message-blacklist. Add or reactivate a blacklisted phone number for the resolved sender.
POST
/api/v2/message-blacklist| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | header | Required | Bearer w91_public_token_here. |
Content-Type | header | Required | Content-Type: application/json. |
authToken | string | Optional | Compatibility body token. auth_token and token are also accepted. |
senderId | string | Optional | WhatsApp registered sender number. |
phone | string | Required | Recipient phone number to blacklist. |
reason | string | Optional | Operational reason such as Customer requested opt-out. |
source | string | Optional | Source label such as MANUAL. |
Add number
curl -X POST "https://graph.whats91.com/api/v2/message-blacklist" \
-H "Authorization: Bearer w91_public_token_here" \
-H "Content-Type: application/json" \
-d '{
"senderId": "916268662275",
"phone": "98765 43210",
"reason": "Customer requested opt-out",
"source": "MANUAL"
}'Add response
{
"success": true,
"message": "Blacklist entry saved",
"data": {
"blacklistEntry": {
"blacklistUid": "bl_abc",
"normalizedPhone": "919876543210",
"displayPhone": "9876543210",
"source": "MANUAL",
"reason": "Customer requested opt-out",
"status": "ACTIVE"
}
},
"metadata": {
"apiVersion": "v2",
"requestId": "request-uuid"
}
}Behavior
- Phone numbers are normalized using the same contact-book phone rules.
- Duplicate active rows for the same customer, sender, and normalized phone are not created.
- Re-adding an inactive number reactivates it.
- Redis blacklist cache for that customer is invalidated after the write.
SDK Examples
Use these examples as starting points for server-side implementations.
cURL
curl -X POST "https://graph.whats91.com/api/v2/message-blacklist" \
-H "Authorization: Bearer w91_live_xxx" \
-H "Content-Type: application/json" \
-d 'curl -X POST "https://graph.whats91.com/api/v2/message-blacklist" \
-H "Authorization: Bearer w91_public_token_here" \
-H "Content-Type: application/json" \
-d '{
"senderId": "916268662275",
"phone": "98765 43210",
"reason": "Customer requested opt-out",
"source": "MANUAL"
}''Node.js
const response = await fetch("https://graph.whats91.com/api/v2/message-blacklist", {
method: "POST",
headers: {
"Authorization": "Bearer w91_live_xxx",
"Content-Type": "application/json"
},
body: JSON.stringify(curl -X POST "https://graph.whats91.com/api/v2/message-blacklist" \
-H "Authorization: Bearer w91_public_token_here" \
-H "Content-Type: application/json" \
-d '{
"senderId": "916268662275",
"phone": "98765 43210",
"reason": "Customer requested opt-out",
"source": "MANUAL"
}')
});
const data = await response.json();
console.log(data);PHP
$ch = curl_init("https://graph.whats91.com/api/v2/message-blacklist");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer w91_live_xxx",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode(curl -X POST "https://graph.whats91.com/api/v2/message-blacklist" \
-H "Authorization: Bearer w91_public_token_here" \
-H "Content-Type: application/json" \
-d '{
"senderId": "916268662275",
"phone": "98765 43210",
"reason": "Customer requested opt-out",
"source": "MANUAL"
}')
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Python
import requests
response = requests.request(
"POST",
"https://graph.whats91.com/api/v2/message-blacklist",
headers={
"Authorization": "Bearer w91_live_xxx",
"Content-Type": "application/json",
},
json=curl -X POST "https://graph.whats91.com/api/v2/message-blacklist" \
-H "Authorization: Bearer w91_public_token_here" \
-H "Content-Type: application/json" \
-d '{
"senderId": "916268662275",
"phone": "98765 43210",
"reason": "Customer requested opt-out",
"source": "MANUAL"
}'
)
print(response.json())C#
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer w91_live_xxx");
var request = new HttpRequestMessage(HttpMethod.Post, "https://graph.whats91.com/api/v2/message-blacklist");
request.Content = new StringContent(
"""curl -X POST \"https://graph.whats91.com/api/v2/message-blacklist\" \
-H \"Authorization: Bearer w91_public_token_here\" \
-H \"Content-Type: application/json\" \
-d '{
\"senderId\": \"916268662275\",
\"phone\": \"98765 43210\",
\"reason\": \"Customer requested opt-out\",
\"source\": \"MANUAL\"
}'""",
Encoding.UTF8,
"application/json"
);
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());