Skip to content
</> PUBLIC REST API

Public REST API: rooms and discovery

These read-only endpoints exist today. Server-side callers can use them; cross-origin browser access is not a promised CORS contract.

Current capabilities only — admin-issued scoped API keys; first-party WebSocket only

Read-only endpoints

  • GET /api/health — service health, no session required.
  • GET /api/rooms — public room listing, plus the session owner’s rooms if authenticated.
  • GET /api/discovery — discoverable rooms with slug, title, online and joinable fields.
  • GET /api/rooms/{slug} — metadata for a valid slug.
  • GET /api/rooms/{slug}/messages — requires session and access to that room; not a public message API.

Using curl

Fetch JSON from your backend or terminal. These public endpoints do not require a key. For Developer API v1, use an admin-issued scoped Authorization: Bearer token.

Shell
curl -sS -H 'Accept: application/json' \
  'https://chat.egytag.com/api/rooms'

curl -sS -H 'Accept: application/json' \
  'https://chat.egytag.com/api/discovery'

curl -sS 'https://chat.egytag.com/api/rooms/general'

Node.js example

Validate HTTP status and JSON shape, set a timeout, and treat presence counts as a changing snapshot.

JavaScript
// Node.js 24+. Run on your own server, not in a cross-origin browser script.
const response = await fetch('https://chat.egytag.com/api/rooms', {
  headers: { Accept: 'application/json' },
  signal: AbortSignal.timeout(8000)
});
if (!response.ok) throw new Error(`Chat Live HTTP ${response.status}`);
const data = await response.json();
if (!data.ok || !Array.isArray(data.rooms)) throw new Error('Bad response');
const rooms = data.rooms.filter(r => !r.private && !r.hidden);
console.log(rooms.map(r => ({ title: r.title, slug: r.slug, online: r.online })));

Authorization and privacy

Public room data does not grant access to private rooms or message history. Browsers are subject to origin policies and no public cross-origin CORS guarantee is made. Use a server-side cache and avoid excessive polling.