createRoom
Client function: create a room; the caller is auto-added as its first member.
import { createRoom } from 'flowstack-sdk'Non-React client function. POST /rooms. Returns the new room_id, which you then pass to useCollection({ layer: 'room', roomId }) to read and write the room's data. Prefer useRooms() inside React.
Signature
createRoom(credentials, config?): Promise<ApiResponse<{ room_id: string }>>Parameters
| Param | Type | Notes | Description |
|---|---|---|---|
credentials | FlowstackCredentials | required | The built-app end-user's credentials. |
config | FlowstackClientConfig | — | Client config. appScope is required — the function throws without it. |
Returns
| Field | Type | Description |
|---|---|---|
| — | Promise<ApiResponse<{ room_id: string }>> | The id of the newly created room. |
Examples
Create a room
const res = await createRoom(credentials, { appScope });
if (res.ok) console.log(res.data.room_id);WarningRequires an
appScope on the FlowstackProvider config — the SDK throws Rooms require an app scope (built-app context). before any network call if it is missing. The ACL is enforced server-side: the SDK never decides membership, so a client-side membership check is decoration, not security.See also
useRooms · listRooms · addRoomMember · useCollection
Source: src/api/client.ts (Rooms, P0-180) · Also available in llms-full.txt and registry.json.