Back
get /v2/rooms/{roomId}/messages

List room messages

Returns messages in a room using cursor-based pagination. Messages are returned in descending order (newest first).

Room messages are stored in time partitions (~28-day windows, ~12 partitions per room per year). Partition boundaries are room-specific. The shard_has_more field indicates if more messages exist in the current partition.

To retrieve all messages in a room:

  1. Call with no cursor to query the current partition (based on current time)
  2. Paginate using next_cursor_sent_at and next_cursor_message_id until shard_has_more is false
  3. Use next_partition_cursor as cursor_sent_at to query the next older partition
  4. Repeat steps 2-3 until you reach the room's created_at timestamp

The next_partition_cursor is always returned (calculated from the partitioning algorithm). Use the room's created_at to determine when to stop querying older partitions.

path params

roomIdstring required

query params

cursorSentAtstring
cursorMessageIdstring
limitinteger

Responses

Was this guide helpful?