Skip to main content

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

ParameterData TypeRequiredDescription
from_idstringNoFor a private chat, the ID of one participant. Maximum length: 32 characters.
target_idstringYesFor a private chat, the ID of the other participant; for a group chat, the group ID. Maximum length: 32 characters.
channel_typeintYesConversation type. 1: private chat; 2: group chat.
clean_timeintNoCutoff timestamp in milliseconds. Messages before this timestamp are cleared.
clean_time_offsetintNoOffset in milliseconds. If clean_time is omitted, the server calculates the cutoff as the current time plus clean_time_offset.
clean_scopeintYesClear 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_idstringNoIf 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"
}