Ban a user
Ban app users, typically used for policy violations.
- A ban duration must be specified in minutes. Maximum 30 days (43,200 minutes).
- Permanent bans are not supported.
- Bans are automatically lifted when the duration expires. You can also manually unban users.
Banning takes effect immediately:
- If the user is currently connected to the messaging service, the connection is immediately terminated.
- The banned user cannot establish an IM connection or actively use IM services.
- Other users can still send messages to the banned user, but the banned user cannot receive messages or push notifications. After unbanning, the user can reconnect and receive offline messages from the ban period. Note that offline messages are stored for up to 7 days — messages older than 7 days are discarded.
Request method
POST: https://Base URL/v4/user/ban
Rate limit: 100 requests per second
Signature required: All server API requests require signature verification. See API request signature.
Request body
The request body is in application/json format and supports the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
userIds | String[] | Yes | User IDs to ban. Maximum 20 per request. |
durationMinutes | Number | Yes | Ban duration in minutes. Maximum 43200 (30 days). |
Request example
HTTP
POST /v4/user/ban HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: xxxxxxxxxxxxxxxx
Content-Type: application/json
{
"userIds": [
"BWSZNmXBD",
"jlk456j5"
],
"durationMinutes": 10
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"code":0}