Skip to main content

Block Contact

Method#

/contacts/modify-blocked#

POST https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/contacts/modify-blocked

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

This method is responsible for blocking or unblocking a contact.


Attributes#

Required#

AttributeTypeDescription
phoneintegerPhone number you want to block or unblock in YOUR chat
actionstringAttribute for blocking or unblocking the contact (block or unblock)

Request Body#

Example

{
"phone": "5544999999999",
"action": "block" or "unblock"
}

Response#

200#

AttributeTypeDescription
valuebooleanAction confirmation attribute

Example

{
"value": true
}

405#

In this case, make sure you are sending the method specification correctly, i.e., check if you sent the POST or GET as specified at the beginning of this topic.

415#

If you receive a 415 error, make sure to add the "Content-Type" header to the request for the object you are sending, most commonly "application/json."


Code#