Overview
Clears message history before a specified time. Use clean_scope to clear messages only for a specified user's view or for all participants in the conversation. The operation is synchronized automatically across clients.
Request
Authentication: Add authentication headers to the request. See Authentication.
Method
POST
Rate limit
100 requests/second
Endpoint https://API domain/apigateway/hismsgs/clean
Content-Type
application/json
Request Parameters
| Parameter | Data Type | Required | Description | |
|---|---|---|---|---|
| from_id | string | No | For a private chat, the ID of one participant. Maximum length: 32 characters. | |
| target_id | string | Yes | For a private chat, the ID of the other participant; for a group chat, the group ID. Maximum length: 32 characters. | |
| channel_type | int | Yes | Conversation type. 1: private chat; 2: group chat. | |
| clean_time | int | No | Cutoff timestamp in milliseconds. Messages before this timestamp are cleared. | |
| clean_time_offset | int | No | Offset in milliseconds. If clean_time is omitted, the server calculates the cutoff as the current time plus clean_time_offset. | |
| clean_scope | int | Yes | Clear scope. 0: clear messages only from the from_id user's view; 1: clear messages for all participants in the private or group conversation. | |
| sender_id | string | No | If specified, only messages sent by this user before clean_time are cleared. Maximum length: 32 characters. |
Request Example
POST /apigateway/hismsgs/clean HTTP/1.1
appkey: appkey
signature: 2e639ae3600a4sdff61fb88b76f485b
nonce: nonce
timestamp: 1672568121910
Content-Type: application/json
{
"from_id":"xxx",
"target_id":"xxx",
"channel_type":1,
"clean_time":1569345643212,
"clean_time_offset":0,
"clean_scope":0,
"sender_id":"user1"
}
Response Example
{
"code":0,
"msg":"sucess"
}