Skip to main content

Overview

After a user is banned, the user cannot connect to the IM Server. The client receives the User Banned status code when attempting to connect. If the user is already connected when the ban is applied, the current connection remains active.

Request

Authentication: Add authentication headers to the request. See Authentication.

Method: POST

Rate limit: 100 requests/second

Endpoint: https://API domain/apigateway/users/banusers/ban

Content-Type: application/json

Request Parameters

ParameterData TypeRequiredDescription
itemsarrayYesList of users to ban.
items[].user_idstringYesID of the user to ban. Maximum length: 32 characters.
items[].end_timenumberNoBan expiration timestamp in milliseconds. A value of 0 indicates a permanent ban.
items[].end_time_offsetnumberNoDuration in milliseconds. If end_time is not specified, the server calculates it by adding end_time_offset to the current time.
items[].scope_keystringYesBan scope. Valid values: default bans the user; platform bans the user on specified platform types; device bans the user on specified devices; ip bans the user from specified IP addresses. Maximum length: 20 characters.
items[].scope_valuestringNoUsed with scope_key to specify scope values. For example, when scope_key=platform, specify a comma-separated list of platforms. Maximum length: 1,000 characters.
items[].extstringNoAdditional information included with the ban. It can be used to provide a custom message to the banned user. Maximum length: 100 characters and 100 bytes.

Request Example

POST /apigateway/users/banusers/ban HTTP/1.1
appkey: appkey
signature: 2e639ae3600a4sdff61fb88b76f485b
nonce: nonce
timestamp: 1672568121910
Content-Type: application/json

{
"items":[
{
"user_id":"user1",
"scope_key":"default",
"scope_value":"xx",
"ext":"aabbcc"
},
{
"user_id":"user2",
"end_time":1715846960362,
"scope_key":"device",
"scope_value":"xxxxxxxx,yyyyyyy",
"ext":"aabbcc"
},
{
"user_id":"user2",
"end_time_offset":300000,
"scope_key":"platform",
"scope_value":"iOS,Android",
"ext":"aabbcc"
},
{
"user_id":"user4",
"scope_key":"ip",
"scope_value":"127.0.0.1,172.20.30.12",
"ext":"aabbcc"
}
]
}

Response Example

{
"code":0,
"msg":"sucess"
}