This section provides an overview of the structure and fields used in Rocket.Chat schema. It aims to assist developers in understanding the data models and their relationship within the system.
User: Schema structure for Rocket.Chat user data.
Room: The schema structure for all Rocket.Chat rooms.
Message: Structure of a Rocket.Chat message object.
Subscription: The structure of how users relate to rooms.
How the schemas fit together
A room is any conversation container: a channel, private group, direct message, or omnichannel conversation. Its
tfield states the type.A message always belongs to one room (its
ridfield) and one sender (itsufield, a trimmed user).A subscription joins one user to one room. It carries the per-user view of the room: unread counts, alerts, favorite status, and notification preferences.
Shared conventions
_id: Every document has a unique ID string. API endpoints reference these asuserId,roomId(orrid), andmsgId.tsholds the creation timestamp and_updatedAtthe last modification. Timestamps are ISO 8601 date strings in API responses.Room types in the
tfield are single letters:c(channel),p(private group),d(direct message), andl(livechat/omnichannel).Embedded references are trimmed. For example, the
ufield on messages and subscriptions contains only_id,username, and sometimesname, not the full user document.