Skip to main content
GET
/
api
/
rooms
List Rooms
curl --request GET \
  --url https://api.example.com/api/rooms \
  --header 'Authorization: <authorization>'
{
  "rooms": [
    {
      "room_id": 123,
      "name": "<string>",
      "joined": true
    }
  ]
}

Overview

Returns a list of all public chat rooms available in the system. Each room includes information about whether the authenticated user has joined it. Private rooms are not included in this listing.

Authentication

Requires a valid authentication token in the Authorization header.

Request

Headers

Authorization
string
required
User authentication token

Response

rooms
array
Array of public room objects
room_id
integer
The unique ID of the room
name
string
The name of the room
joined
boolean
Indicates whether the authenticated user is a member of this room

Status Codes

  • 200: Successfully retrieved room list
  • 400: Missing token
  • 401: Unauthorized - invalid token

Error Responses

Missing Token

{
  "error": "missing token"
}

Unauthorized

{
  "error": "unauthorized"
}

Example

curl -X GET https://api.mirage.com/api/rooms \
  -H "Authorization: your-auth-token"

Success Response

{
  "rooms": [
    {
      "room_id": 1,
      "name": "General Discussion",
      "joined": true
    },
    {
      "room_id": 2,
      "name": "Tech Talk",
      "joined": false
    },
    {
      "room_id": 5,
      "name": "Random",
      "joined": true
    }
  ]
}

Notes

  • Only public rooms (where is_private=0) are returned.
  • Private rooms are not visible through this endpoint.
  • The joined field helps clients display which rooms the user is already a member of.
  • The system enforces a maximum of 5 public rooms total.

Build docs developers (and LLMs) love