Skip to main content
Rooms are temporary chat spaces that expire after 10 minutes. Each room has a unique ID and maintains a list of connected users.

Create room

This is the only endpoint that does not require authentication.
Creates a new chat room with a unique ID and sets an initial TTL of 10 minutes.
curl -X POST https://your-domain.com/api/room/create

Response

roomId
string
required
A unique identifier for the newly created room. This ID is generated using nanoid and is used for all subsequent room operations.

Get room TTL

Requires authentication via roomId query parameter and x-auth-token cookie.
Retrieves the remaining time to live (TTL) for a room in seconds.
curl -X GET "https://your-domain.com/api/room/ttl?roomId=V1StGXR8_Z5jdHi6B-myT" \
  -H "Cookie: x-auth-token=your-token-here"

Query parameters

roomId
string
required
The unique identifier of the room to check

Response

ttl
number
required
The remaining time to live in seconds. Returns 0 if the room has expired or does not exist.

Delete room

Requires authentication via roomId query parameter and x-auth-token cookie.
Permanently deletes a room and all associated data, including messages and metadata. This action cannot be undone.
curl -X DELETE "https://your-domain.com/api/room?roomId=V1StGXR8_Z5jdHi6B-myT" \
  -H "Cookie: x-auth-token=your-token-here"

Query parameters

roomId
string
required
The unique identifier of the room to delete

Response

Returns an empty response with status 200 on success.

What gets deleted

When you delete a room, the following data is removed:
  • Room metadata (connected users, creation time)
  • All messages in the room
  • Room connection data
  • Realtime channel subscriptions (all connected clients receive a chat.destroy event)
All connected users will be immediately disconnected and receive a destruction notification through the realtime channel.

Build docs developers (and LLMs) love