Skip to Content
HomeLink Hub
Chat

Delete a message

DELETE
/api/v1/chat/messages/{messageId}

Access: Bearer token required. Also requires: Caller must be the sender of the message.

Soft-deletes one of the caller's own messages by setting its deletedAt. Deleted messages disappear from the messages endpoint and from socket history, but remain inside the messages array returned by the rooms list, and the room's lastMessage preview is not rewritten. No socket event is emitted, so other clients only notice on their next fetch. The success body has no data. All failures of this endpoint are thrown as plain errors and therefore come back as 500 in the standard error envelope, including not-found, not-owner and a malformed messageId.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Access token returned by sign-in. Send it as Authorization: Bearer <token>.

Path Parameters

messageId*string

ObjectId of the embedded message to delete.

Response Body

Message soft-deleted

application/json
  1. response
success*boolean
message*string
Example Request
curl -X DELETE 'http://localhost:4000/api/v1/chat/messages/string'
Example Response
{  "success": true,  "message": "Message deleted successfully"}