Skip to main content

Matrix rooms

A room is a shared, replicated event history plus the state derived from it. This page covers the parts developers meet most; links go to spec v1.19.

Identifiers​

IdentifierExampleNotes
Room ID, room v12!8sQ1Ex3dBJbCgFm4eN0LkSUAtjbAEdZ8wVSA1dl1YtkThe hash of the m.room.create event, no server part
Room ID, room v1–11!OGEhHVWSdvArJzumhm:matrix.orgOpaque localpart plus the creating server's name
Room alias#matrix:matrix.orgHuman-readable pointer to a room ID; can change

Treat room IDs as opaque strings. Never parse a server name out of one: v12 room IDs don't have one, and in older rooms the domain only says who created the room, not who still hosts it. If you need a server to join through, use via servers from links or m.space.child events. See room IDs.

Creating a room​

POST /_matrix/client/v3/createRoom
Content-Type: application/json

{
"preset": "private_chat",
"name": "Project room",
"topic": "Planning",
"invite": ["@bob:example.org"]
}

Leave out room_version to get the server's default. The spec says servers SHOULD default to version 12; Synapse does since 1.162 (2026-09-29).

Presets set three state events (createRoom):

Presetjoin_ruleshistory_visibilityguest_accessOther
private_chatinvitesharedcan_join
trusted_private_chatinvitesharedcan_joinInvitees get the creator's power; in v12 they become additional_creators
public_chatpublicsharedforbidden

Presets do not turn on encryption. To create an encrypted room, include an m.room.encryption event in initial_state.

Room state​

State events are keyed by (type, state_key); the latest one for each pair is the current state. Common ones:

TypeWhat it controls
m.room.createRoom version, creators, type (m.space for spaces), predecessor
m.room.power_levelsWho can do what
m.room.join_rulesWho can join
m.room.history_visibilityWho can read past messages
m.room.encryptionE2EE settings (can't be turned off once on)
m.room.server_aclWhich servers may take part
m.room.name, m.room.topic, m.room.avatarDisplay information

Join rules​

join_ruleWho can joinRoom versions
publicAnyoneall
inviteInvited usersall
knockAnyone can ask; members with invite power approve7+
restrictedMembers of any room listed in allow (typically a space), or invited users8+
knock_restrictedAs restricted, and others can knock10+

See m.room.join_rules.

History visibility​

ValueWho can read history
world_readableAnyone, including non-members
sharedMembers can read everything, including from before they joined
invitedMembers can read from the point they were invited
joinedMembers can read from the point they joined

Spaces​

A space is a room with "type": "m.space" in its create event. Children are linked by m.space.child state events in the space (state key = child room ID), and children can point back with m.space.parent:

{
"type": "m.space.child",
"state_key": "!child-room-id",
"content": {
"via": ["example.org"],
"suggested": true,
"order": "a"
}
}

Clients browse a space with GET /_matrix/client/v1/rooms/{roomId}/hierarchy. See spaces.

To preview a room before joining, v1.15 added GET /_matrix/client/v1/room_summary/{roomIdOrAlias}.

Room version 12​

Room version 12 (spec v1.16, 2025-09) came out of the 2025 "Project Hydra" security work. For clients and bots it changes three things (room version 12):

  • Room IDs are the create event's hash, with no server name.
  • Creators (the create event's sender plus additional_creators) have unlimited power level. They are not listed in m.room.power_levels and cannot be demoted, kicked or banned by anyone, including power level 100 admins and moderation bots.
  • State resolution v2.1 fixes state resets. See Server-Server API.

For upgrade steps, code changes and server support, see Room version 12.

When a server creates a v12 room, the power level it sets for m.room.tombstone (upgrading the room) must be higher than state_default. Synapse uses 150, so power level 100 admins can't upgrade the room by default.

Room upgrades​

To move a room to a new version, a user with permission calls:

POST /_matrix/client/v3/rooms/{roomId}/upgrade
Content-Type: application/json

{ "new_version": "12", "additional_creators": ["@co-admin:example.org"] }

The server creates the new room (whose m.room.create has a predecessor pointing back), copies key state, and sends an m.room.tombstone in the old room:

{
"type": "m.room.tombstone",
"state_key": "",
"content": {
"body": "This room has been replaced",
"replacement_room": "!new-room-id"
}
}

Members are not moved. Clients see the tombstone and offer to join the replacement room. When upgrading to v12, the upgrading user becomes a creator of the new room; other creators must be listed in additional_creators, as they are not copied over. See room upgrades.

Resources​