Skip to main content

Matrix Specification

The Matrix specification defines how Matrix works. Understanding it helps you build better applications and troubleshoot issues.

Spec Structure

The specification is divided into several APIs:

APIPurpose
Client-ServerClient ↔ Homeserver
Server-ServerHomeserver ↔ Homeserver (Federation)
Application ServiceBridges & bots
Identity Service3PID lookup
Push GatewayPush notifications

Current Version

The latest stable version is v1.11 (as of 2024).

Check the current version at spec.matrix.org.

Room Versions

Room behavior is defined by room versions:

VersionFeaturesStatus
1-5LegacyDeprecated
6Stricter validationDeprecated
7-8Knock supportDeprecated
9Restricted roomsCurrent
10Knock + restrictedCurrent
11Latest featuresLatest

Creating Rooms

Specify room version when creating:

{
"room_version": "11",
"name": "My Room"
}

MSCs (Matrix Spec Changes)

New features are proposed through MSCs:

  1. Proposal - Write MSC document
  2. Review - Community feedback
  3. FCP - Final Comment Period
  4. Merge - Added to spec

Notable MSCs

MSCFeature
MSC1772Spaces
MSC2674Event relationships (threads)
MSC3401Native group calls
MSC3575Sliding Sync

Track MSCs at matrix.org/docs/spec/proposals.

Reading the Spec

Endpoints

Each endpoint is documented with:

  • HTTP method and path
  • Request parameters
  • Response format
  • Error codes

Example:

POST /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}

Event Schemas

Events have defined schemas:

{
"type": "m.room.message",
"content": {
"msgtype": "m.text",
"body": "Hello"
}
}

Useful Spec Sections

For Client Developers

For Server Admins

Resources


Continue: Client-Server API | Server-Server API