Room participation

Get a list of events for this room

This API returns a list of message and state events for a room. It uses pagination query parameters to paginate history in the room.

Note: This endpoint supports lazy-loading of room member events. See Lazy-loading room members for more information.

get/_matrix/client/v3/rooms/{roomId}/messages

Request

Path parameters

roomIdstring mx-room-id required

The room to get events from.

Query parameters

fromstring

The token to start returning events from. This token can be obtained from a prev_batch or next_batch token returned by the /sync endpoint, or from an end token returned by a previous request to this endpoint.

This endpoint can also accept a value returned as a start token by a previous request to this endpoint, though servers are not required to support this. Clients should not rely on the behaviour.

If it is not provided, the homeserver shall return a list of messages from the first or last (per the value of the dir parameter) visible event in the room history for the requesting user.

tostring

The token to stop returning events at. This token can be obtained from a prev_batch or next_batch token returned by the /sync endpoint, or from an end token returned by a previous request to this endpoint.

dir'b' | 'f' required

The direction to return events from. If this is set to f, events will be returned in chronological order starting at from. If it is set to b, events will be returned in reverse chronological order, again starting at from.

limitinteger

The maximum number of events to return. Default: 10.

filterstring

A JSON RoomEventFilter to filter returned events with.

Response

A list of messages with a new token to request more.

endstring

A token corresponding to the end of chunk. This token can be passed back to this endpoint to request further events.

If no further events are available (either because we have reached the start of the timeline, or because the user does not have permission to see any more events), this property is omitted from the response.

startstring required

A token corresponding to the start of chunk. This will be the same as the value given in from.

Example response

{
  "chunk": [
    {
      "content": {
        "membership": "join"
      },
      "event_id": "$26RqwJMLw-yds1GAH_QxjHRC1Da9oasK0e5VLnck_45",
      "origin_server_ts": 1632489532305,
      "sender": "@example:example.org",
      "state_key": "@user:example.org",
      "type": "m.room.member",
      "unsigned": {
        "age": 1567437,
        "membership": "join",
        "redacted_because": {
          "content": {
            "reason": "spam"
          },
          "event_id": "$Nhl3rsgHMjk-DjMJANawr9HHAhLg4GcoTYrSiYYGqEE",
          "origin_server_ts": 1632491098485,
          "redacts": "$26RqwJMLw-yds1GAH_QxjHRC1Da9oasK0e5VLnck_45",
          "room_id": "!jEsUZKDJdhlrceRyVU:example.org",
          "sender": "@moderator:example.org",
          "type": "m.room.redaction",
          "unsigned": {
            "age": 1257
          }
        }
      },
      "room_id": "!jEsUZKDJdhlrceRyVU:example.org"
    }
  ],
  "state": [
    {
      "content": {
        "membership": "join"
      },
      "event_id": "$26RqwJMLw-yds1GAH_QxjHRC1Da9oasK0e5VLnck_45",
      "origin_server_ts": 1632489532305,
      "sender": "@example:example.org",
      "state_key": "@user:example.org",
      "type": "m.room.member",
      "unsigned": {
        "age": 1567437,
        "membership": "join",
        "redacted_because": {
          "content": {
            "reason": "spam"
          },
          "event_id": "$Nhl3rsgHMjk-DjMJANawr9HHAhLg4GcoTYrSiYYGqEE",
          "origin_server_ts": 1632491098485,
          "redacts": "$26RqwJMLw-yds1GAH_QxjHRC1Da9oasK0e5VLnck_45",
          "room_id": "!jEsUZKDJdhlrceRyVU:example.org",
          "sender": "@moderator:example.org",
          "type": "m.room.redaction",
          "unsigned": {
            "age": 1257
          }
        }
      },
      "room_id": "!jEsUZKDJdhlrceRyVU:example.org"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.