Skip to main content

Endpoint

GET /api/user_rooms
Get a list of all chat rooms that the authenticated user has joined, including both public and private rooms.

Headers

Authorization
string
required
User authentication token received from login

Response

rooms
array
Array of room objects the user is a member of
error
string
Error message if the request failed

Status codes

  • 200: Rooms retrieved successfully
  • 401: Unauthorized (invalid or missing token)

Example request

curl https://api.example.com/api/user_rooms \
  -H "Authorization: your-token-here"

Example responses

{
  "rooms": [
    {
      "room_id": 1,
      "name": "General Chat",
      "is_private": 0
    },
    {
      "room_id": 5,
      "name": "Team Alpha",
      "is_private": 1
    },
    {
      "room_id": 8,
      "name": "Gaming Lounge",
      "is_private": 0
    }
  ]
}

Notes

  • Returns both public and private rooms the user has joined
  • Does not include public rooms the user hasn’t joined
  • Use this endpoint to display a user’s room list in navigation
  • Use /api/rooms to discover new public rooms to join

Build docs developers (and LLMs) love