REST API
- Overview
- Limits
- Errors
- GETGet Account Settings
- Authentication
- Users
- Chat
- Overview
- Dialog Model
- POSTCreate Dialog
- GETList Dialogs
- GETGet Dialog by ID
- PUTUpdate Dialog
- DELDelete Dialog
- GETGet Notification Settings
- PUTUpdate Notification Settings
- Message Model
- POSTCreate Message
- GETList Messages
- GETGet Message by ID
- PUTUpdate Message
- PATCHMark All Messages as Delivered
- PATCHMark All Messages as Read
- DELDelete Message
- GETGet Unread Messages Count
- Content
- Push Notifications
- Custom Objects
- Address Book
- AI
Delete Message
Remove a message for a current user.
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
1. Specify if you want to delete messages from all chat histories
Set a force
parameter to 1
to delete messages from all chat histories.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
-d "force=1" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
2. Set the IDs of the messages
Specify the IDs of the messages via comma to refer to specific messages that should be deleted from all users’ histories.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
-d "force=1" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
3. As a result, the messages will be deleted from all chat histories.
If you’re not the owner of the dialog, the API will return the following message: “WrongPermissions”. This means that a user doesn’t have permissions to delete a message from all users’ histories.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
-d "force=1" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
1. Set the IDs of the messages
Specify the IDs of the messages via comma to refer to specific messages that should be deleted from your own chat history.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
2. As a result, the messages are removed for a user who has sent the request without affecting chat histories of other users.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
1. Use 'Authorization' header to pass API key
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
2. Use 'On-Behalf-Of' header to pass user id
To execute a request on behalf of a specific user.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
3. Set the IDs of the messages
Specify the IDs of the messages via comma to refer to specific messages that should be deleted from the chat history of the user with ID 123.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
4. As a result, the messages are removed for a user who has sent the request without affecting chat histories of other users.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
1. Use 'Authorization' header to pass API key
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
2. Set the IDs of the messages
Specify the IDs of the messages via comma to refer to specific messages that should be deleted from all users’ histories.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
3. As a result, the messages will be deleted from all chat histories.
If the API key is not related to the same application as the messages, the API will return the following message: “WrongPermissions”. This means that a user doesn’t have permission to delete a message.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
1. Specify if you want to delete messages from all chat histories
Set a force
parameter to 1
to delete messages from all chat histories.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
-d "force=1" \
2. Use 'Authorization' header to pass API key
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
-d "force=1" \
3. Set the IDs of the messages
Specify the IDs of the messages via comma to refer to specific messages that should be deleted from all users’ histories.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
-d "force=1" \
4. As a result, the messages will be deleted from all chat histories.
If the API key is not related to the same application as the messages, the API will return the following message: “WrongPermissions”. This means that a user doesn’t have permission to delete a message.
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/chat/Message/5d76b949a0eb4721f80b72ab,5d76b657a28f9a0cc7cb0f99,5d76b6sdfff9a0cc7cb023.json
-d "force=1" \
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
Body Parameters
force=1
to perform. Only the owner can do it. Headers
ApiKey {your_api_key}
. Must be used either QB-Token or Authorization.Responses
An error response
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"
]
}
}
Was this page helpful?
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"
]
}
}