Skip to main content

Delete Chat Message

Marks a chat message as deleted. Note that this is a soft delete - the message is not removed from the database but is marked as deleted.

Endpoint

DELETE /api/chat/:id/:delete/

Authentication

Authentication is required. The request must include a valid authentication token. Only the message author or an administrator can delete a message.

Path Parameters

ParameterTypeDescription
idintegerThe ID of the chat message to delete
deletestringMust be set to "true" to confirm deletion

Request Body

ParameterTypeRequiredDescription
idintegerYesThe ID of the chat message to delete
deletebooleanYesMust be set to true to confirm deletion

Example Request Body

{
"id": 4212,
"delete": true
}

Response

Success Response

Status Code: 200 OK

Response Body:

{
"success": true
}

Error Response

Status Code: 400 Bad Request or 403 Forbidden

Response Body:

{
"error": "Error message"
}

Notes

  • This endpoint performs a soft delete - the message is not removed from the database but is marked as deleted.
  • When a message is deleted, it will still appear in the chat history but with the deleted flag set to true.
  • The message content may be replaced with a placeholder like "[Message deleted]" when displayed to users.
  • Only the message author or an administrator can delete a message.
  • When a parent message is deleted, its replies remain visible.

Example

Request

curl -X DELETE "https://api.tribesocial.io/api/chat/4212/true/" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-d '{
"id": 4212,
"delete": true
}'

Response

{
"success": true
}