logo
Use this method to unban a chat member from accessing chat.
Field
Type
Required
Description
method
String
Yes
"unbanChatMember"
app_id
String
Yes
Unique identifier for App.
chat_id
String
Yes
Unique identifier for chat Group or Channel where the member belongs.
user_id
String
Yes
Unique identifier for the banned user.
reference
String
Optional
Unique identifier for the request. This reference will be echoed in the response.

Preconditions for API Functionality

The following table outlines the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
Condition
Description
API must have "Manage Chats" permission
The API needs "Manage Chats" permission to manage chats within the app.
API must have the "Ban/unBan Chat Members" permission
The API needs "Ban/unBan Chat Members" permission to ban and block members within chats.
API must be a moderator or an admin in the chat
The API requires admin privileges in the chat to execute view or creation actions.

Response:

chatMember

✅ On success, the chatMember method is returned. The chatMember object is returned with the status Active. If unbanned, the member is removed from the blacklist.
Field
Type
Returned
Description
method
String
Yes
"chatMember"
app_id
String
Yes
Unique identifier for App.
chatMember
Yes
chatMember Object.
reference
String
Optional
Unique identifier echoed from the request.

Example:

Requests

json
{ "method": "unbanChatMember", "app_id": "90090684293000559", "chat_id": "90090684438172188", "user_id": "90089584789572153", "reference": "123456789" }
java
String chatId = "4522291356145774"; String userId = "90089584758972053"; api.unbanChatMember(chatId, userId);
javascript
let chatId = "4522291356145774"; let userId = "90089584758972053"; api.unbanChatMember(chatId, userId);
python
napi.unban_chat_member("chatId", "userId")

Response

json
{ "method": "chatMember", "app_id": "90090684293000559", "chatMember": { "view": null, "chat": { "id": "90090684438172188", }, "type": null, "user": { "id": "90089584789572153" }, "status": "Banned" }, "reference": "123456789", }