Block User

Description
This API allows businesses to block WhatsApp users from contacting them further. Blocking a user prevents them from sending new messages to your WhatsApp Business Account, and your business will also be unable to send messages to the user.

Note:

  • You can only block users who have messaged your business in the last 24 hours.
  • There is a 64,000 user blocklist limit per WhatsApp Business Account.

cURL Request

curl --location 'https://api.gupshup.io/wa/app/{{appId}}/user/block' \
--header 'apikey: {{apiKey}}' \
--header 'Content-Type: application/json' \
--data '{
    "messaging_product": "whatsapp",
    "block_users": [
        {
            "user": "919876543210"
        }
    ]
}'

Request Parameters

KeyDescriptionConstraints
Headers
apikeyApikey of appShould be a valid gupshup.io apikey
Path Params
appIdappId of the appShould be a valid appId

Response Parameters

KeyDescriptionConstraints
inputPhone number of a WhatsApp user
wa_idUnique ID of a WhatsApp user

Status Codes

Status Code

Response

Comments

Success

200

  { 
  "block_users": { 
  "added_users": [ 
  { 
  "input": "919163805873", 
  "wa_id": "919163805873" 
  } 
  ] 
  },
  "messaging_product": "whatsapp",
  "status": "success" 
  }

Error

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>`"  
  }

401

  {  
  "message": "Authentication Failed",  
  "status": "error"  
  }

When API authentication fails.


Common Error Codes

CodeDescription
139100Failed to block/unblock some users
131047Re-engagement required (24-hour rule)
139101Blocklist limit reached
130429Rate limit hit