DELETE
/
chat
/
Message
/
{chat_message_id}
,
{chat_message_id}
.json
curl -X DELETE \
-H "Content-Type: application/json" \
-H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
{
  "SuccessfullyDeleted": {
    "ids": [
      "5d76b657a28f9a0cc7cb0f99",
      "5d76b949a0eb4721f80b72ab"
    ]
  },
  "NotFound": {
    "ids": [
      "5d76b6sdfff9a0cc7cb023"
    ]
  }
}

Recipes

Any user in the dialog’s occupant_ids is able to remove a message from the dialog. The message will only be removed for the current user. The message will still be viewable in the chat history for all other users in the dialog.

You may be wondering why this request only deletes the message for the current user. It is to allow deletion functionality within your app and ensure the message does not reappear in the user chat history, but without affecting the history of other users.

It is possible to completely remove a message by the owner - pass force=1.

Path Parameters

chat_message_id
string
ID of the message. Generated automatically by the server after message creation.

Body Parameters

force
integer
Delete message for everyone. Set force=1 to perform. Only the owner can do it.

Headers

QB-Token
string
required
A user or application session token. See our Authentication page to learn more about session tokens. Must be used either QB-Token or Authorization.
Authorization
string
default:"ApiKey {your_api_key}"
API key from Dashboard. Expected format: ApiKey {your_api_key}. Must be used either QB-Token or Authorization.
On-Behalf-Of
string
User ID. The user ID of the user on whose behalf the request is being made.

Responses

curl -X DELETE \
-H "Content-Type: application/json" \
-H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
{
  "SuccessfullyDeleted": {
    "ids": [
      "5d76b657a28f9a0cc7cb0f99",
      "5d76b949a0eb4721f80b72ab"
    ]
  },
  "NotFound": {
    "ids": [
      "5d76b6sdfff9a0cc7cb023"
    ]
  }
}