Rooms API

Create Room

POST /_matrix/client/v3/createRoom
{
  "name": "General Chat",
  "topic": "A room for general discussion",
  "room_alias_name": "general",
  "visibility": "public",
  "room_version": "10",
  "creation_content": {
    "type": "m.space"
  },
  "initial_state": [
    {
      "type": "m.room.history_visibility",
      "state_key": "",
      "content": { "history_visibility": "shared" }
    }
  ],
  "invite": ["@bob:localhost"],
  "is_direct": false
}

Response:

{ "room_id": "!abc:localhost" }

Supports Space creation via creation_content.type = "m.space".

Send Message

PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}
{
  "msgtype": "m.text",
  "body": "Hello, Matrix!"
}

Send State Event

PUT /_matrix/client/v3/rooms/{roomId}/state/{eventType}/{stateKey}

Room Membership

Join

POST /_matrix/client/v3/join/{roomIdOrAlias}

Invite

POST /_matrix/client/v3/rooms/{roomId}/invite
{ "user_id": "@bob:localhost" }

Leave

POST /_matrix/client/v3/rooms/{roomId}/leave

Ban

POST /_matrix/client/v3/rooms/{roomId}/ban
{ "user_id": "@bob:localhost", "reason": "Spam" }

Room State

GET /_matrix/client/v3/rooms/{roomId}/state

Returns all current state events.

GET /_matrix/client/v3/rooms/{roomId}/state/{eventType}/{stateKey}

Returns a specific state event.

Redact Event

PUT /_matrix/client/v3/rooms/{roomId}/redact/{eventId}/{txnId}
{ "reason": "Inappropriate content" }

Joined Rooms

GET /_matrix/client/v3/joined_rooms
{ "joined_rooms": ["!abc:localhost", "!def:localhost"] }

Public Rooms

GET /_matrix/client/v3/publicRooms

Returns published rooms with name, topic, avatar populated from state events.

POST /_matrix/client/v3/publicRooms

Search public rooms with filter.

Room Tags

GET /_matrix/client/v3/user/{userId}/rooms/{roomId}/tags
PUT /_matrix/client/v3/user/{userId}/rooms/{roomId}/tags/{tag}
DELETE /_matrix/client/v3/user/{userId}/rooms/{roomId}/tags/{tag}

Room Directory

GET /_matrix/client/v3/directory/room/{roomAlias}
PUT /_matrix/client/v3/directory/room/{roomAlias}
DELETE /_matrix/client/v3/directory/room/{roomAlias}

Report Content

POST /_matrix/client/v3/report

Relations (v1)

GET /_matrix/client/v1/rooms/{roomId}/relations/{eventId}
GET /_matrix/client/v1/rooms/{roomId}/relations/{eventId}/{relType}
GET /_matrix/client/v1/rooms/{roomId}/relations/{eventId}/{relType}/{eventType}

Returns related events (threads, annotations, edits) with pagination.

Hierarchy (v1)

GET /_matrix/client/v1/rooms/{roomId}/hierarchy

Returns the space hierarchy tree with room metadata.