Sync API

GET /sync

GET /_matrix/client/v3/sync?since=s72595_0_0&timeout=30000&full_state=false

The primary endpoint for clients to receive events. Supports long-polling.

Query Parameters

ParameterTypeDefaultDescription
filterJSON/stringFilter object or saved filter ID
sincestringStream token for incremental sync
timeoutint0Long-poll timeout in ms (max 30000)
full_stateboolfalseInclude all state regardless of since

Response

{
  "next_batch": "s72595_0_1",
  "rooms": {
    "join": {
      "!room:localhost": {
        "timeline": {
          "events": [...],
          "limited": false,
          "prev_batch": "t123"
        },
        "state": { "events": [...] },
        "ephemeral": { "events": [
          { "type": "m.typing", "content": {"user_ids": ["@bob:localhost"]} }
        ]},
        "account_data": { "events": [...] },
        "unread_notifications": {
          "notification_count": 5,
          "highlight_count": 1
        }
      }
    },
    "invite": {},
    "leave": {}
  },
  "presence": { "events": [...] },
  "device_lists": {
    "changed": ["@bob:localhost"],
    "left": ["@charlie:localhost"]
  },
  "device_one_time_keys_count": {
    "signed_curve25519": 50
  }
}

POST /filter

POST /_matrix/client/v3/filter

Save a filter for reuse:

{
  "room": {
    "rooms": ["!room:localhost"],
    "state": { "types": ["m.room.member", "m.room.name"] },
    "timeline": { "limit": 100 },
    "ephemeral": { "types": ["m.typing", "m.receipt"] }
  }
}

GET /messages

GET /_matrix/client/v3/rooms/{roomId}/messages?from=t123&dir=b&limit=50

Paginate backwards/forwards through room timeline.

ParameterDescription
fromStart token
dirb (backwards/newer) or f (forwards/older)
limitMax events (default 50, max 100)
filterJSON filter for event types

GET /context

GET /_matrix/client/v3/rooms/{roomId}/context/{eventId}?limit=50

Returns events around a specific event (for thread/reply context).

Typing

PUT /_matrix/client/v3/rooms/{roomId}/typing/{userId}
{
  "typing": true,
  "timeout": 30000
}

Read Markers

POST /_matrix/client/v3/rooms/{roomId}/read_markers
{
  "m.fully_read": "$latest_event",
  "m.read": "$read_event",
  "m.read.private": "$private_read_event"
}

Receipts

POST /_matrix/client/v3/rooms/{roomId}/receipt/{receiptType}/{eventId}

Send read receipts (m.read) or private read receipts (m.read.private).

Notifications

GET /_matrix/client/v3/notifications?from=t123&limit=50

Returns pending notifications with optional highlight filter.