Add to blocklist
Add one or more users to a specified user's blocklist. Blocked users cannot send direct messages to the blocking user.
- Blocking is a one-directional operation. For example, if user A blocks user B, B cannot send messages to A. However, A can still send messages to B.
- Server API direct message sending is not restricted by the blocklist by default. To enable blocklist checking, set
verifyBlacklistto1when calling the relevant API.
tip
Maintain a copy of the blocklist data on your app server for business data processing.
Request method
POST: https://Base URL/v4/user/blocklist/add
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 |
|---|---|---|---|
userId | String | Yes | The user ID of the blocking user. |
targetUserIds | String[] | Yes | User IDs to add to the blocklist. Maximum 20 per request. |
Request example
HTTP
POST /v4/user/blocklist/add HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: xxxxxxxxxxxxxxxx
Content-Type: application/json
{
"userId": "jlk456j5",
"targetUserIds": [
"jlk454",
"jlk457"
]
}
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}