RemoveAdmin#
The method removes a participant from group chat administration rights.
Request#
To remove a participant from group chat administration rights, you have to execute a request at:
 POST    
 {{apiUrl}}/waInstance{{idInstance}}/removeAdmin/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.
Request parameters#
| Parameter | Type | Mandatory | Description | 
|---|---|---|---|
| groupId | string | Yes | Group chat Id | 
| participantChatId | string | Yes | Id of a group participant, who you'd like to remove from group administration rights | 
Request body example#
Removing a participant from group administration rights:
{
    "groupId": "79876543210-1587570015@g.us",
    "participantChatId": "79001234565@c.us"
}
Response#
Response parameters#
| Parameter | Type | Description | 
|---|---|---|
| removeAdmin | boolean | Flag of removing a group participant from administration rights | 
Response body example#
{
    "removeAdmin": true
}
RemoveAdmin errors#
For a list of errors common to all methods, refer to Common errors section
| HTTP code | Error iD | Description | 
|---|---|---|
| 200 | "removeAdmin": false | Incorrect groupId | 
| 200 | "removeAdmin": false | The number is not a participant of the group | 
| 400 | Bad RequestValidation failed | Validation error | 
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/removeAdmin/{{apiTokenInstance}}"
payload = {(
 "groupId": "11011234567@g.us", 
 "participantChatId":"79001234567@c.us")
}
headers = {
  'Content-Type': 'application/json'
}
response = requests.post(url, json=payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/removeAdmin/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "groupId": "120363043968066561@g.us",
    "participantChatId": "79001234567@c.us"
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/removeAdmin/")
    .append({{apiTokenInstance}});
var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
var jsonBody = "{\"groupId\": \"111111112222222333333@g.us\",\"participantChatId\": \"12345678910@c.us\"}";
var requestEntity = new HttpEntity<>(jsonBody, headers);
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.POST, requestEntity, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/removeAdmin/")
    .append({{apiTokenInstance}});
var response = Unirest.post(requestUrl.toString())
    .header("Content-Type", "application/json")
    .body("{\"groupId\": \"111111112222222333333@g.us\",\"participantChatId\": \"12345678910@c.us\"}")
    .asString();
System.out.println(response);
Sub RemoveAdmin()
    Dim url As String
    Dim RequestBody As String
    Dim http As Object
    Dim response As String
    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/removeAdmin/{{apiTokenInstance}}"
    ' groupId - group chat identifier, participantChatId - identifier of the group participant whose group administration rights need to be revoked
    RequestBody = "{""groupId"":""120123400367448864@g.us"",""participantChatId"":""70123456789@c.us""}"
    Set http = CreateObject("MSXML2.XMLHTTP")
    With http
        .Open "POST", url, False
        .setRequestHeader "Content-Type", "application/json"
        .Send RequestBody
    End With
    response = http.responseText
    Debug.Print response
    ' Outputting the answer to the desired cell
    Range("A1").Value = response
    Set http = Nothing
End Sub