Skip to Content
HomeLink Hub
Chat

List messages in a room

GET
/api/v1/chat/rooms/{roomId}/messages

Access: Bearer token required.

Messages from one room with soft-deleted messages removed and senderId populated (firstName, lastName, avatar, email). Messages are returned in stored order, oldest first, and the window is taken from the start of the conversation: offset=0&limit=50 is the first (oldest) 50 messages, not the latest 50. To page towards newer messages increase offset. Only participants of the room can read it; anyone else, and any unknown or deleted room id, gets a 403. Fetching does not mark messages as read.

Envelope: chat endpoints do not use the standard {status, success, message, data} wrapper. Success bodies are {success, data} and the handler's own 400s are {success: false, message}; only errors that fall through to the global error middleware get the standard error envelope.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

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

Path Parameters

roomId*string

ObjectId of the chat room.

Query Parameters

limit?integer

Maximum number of messages to return. Not capped.

Default50
offset?integer

Number of non-deleted messages to skip, counted from the oldest message.

Default0

Response Body

Messages, oldest first

application/json
  1. response
success*boolean
data*array<>
Example Request
curl -X GET 'http://localhost:4000/api/v1/chat/rooms/string/messages'
Example Response
{  "success": true,  "data": [    {      "senderId": {        "_id": "665f1c2e9b1d4a0012ab34c4",        "firstName": "Amaka",        "lastName": "Eze",        "avatar": "https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/amaka.jpg",        "email": "amaka.eze@example.com"      },      "content": "Good afternoon, is the flat still available for inspection this Saturday?",      "messageType": "TEXT",      "readBy": [],      "deletedAt": null,      "editedAt": null,      "replyToId": null,      "_id": "6660a7d49b1d4a0012ab3551",      "createdAt": "2026-06-05T14:02:10.107Z",      "updatedAt": "2026-06-05T14:02:10.107Z"    }  ]}