Documentation Index

Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt

Use this file to discover all available pages before exploring further.

Sync Messages

Prev Next
Get
/api/v1/chat.syncMessages

List updated and deleted messages in a room. Use lastUpdate to retrieve changes made after a specific date. To limit the results to messages originally sent at or after a specific date, use fromTs together with lastUpdate.

You can also paginate updated or deleted messages with the next, previous, and type parameters. This endpoint replaces the deprecated loadMissedMessages method, which is scheduled for removal in Rocket.Chat 9.0.0.

Changelog

Version Description
8.8.0 Added the fromTs parameter.
1.0.0 Added
Header parameters
X-Auth-Token
stringRequired

The authToken of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired

The userId of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ
Query parameters
roomId
stringRequired

The room ID.

Example6GFJ3tbmHiyHbahmC
count
integer

The number of items to return. Refer to the official documentation to learn more.

Example50
lastUpdate
string (date-time)

The date and time after which message updates and deletions should be returned.

Example2019-04-16T18:30:46.669Z
fromTs
string (date-time)

The inclusive date and time boundary for the original message timestamp. Only messages originally sent at or after this date are considered. You must use this parameter together with lastUpdate.

Example2019-04-01T00:00:00Z
next
string

The cursor returned in result.cursor.next to retrieve the next page. Use either next or previous.

previous
string

The cursor returned in result.cursor.previous to retrieve the previous page. Use either next or previous.

type
string

The message change type to retrieve when using cursor pagination. This parameter is required with next or previous.

Valid values[ "UPDATED", "DELETED" ]
Responses
200

OK

Example
{
  "result": {
    "updated": [
      {
        "_id": "ak3WdaLbf4P7ZW3wQ",
        "rid": "5qW6ssMFyzWjJev69",
        "u": {
          "_id": "FWfHnJmcudrCagGDX",
          "username": "555192857993",
          "name": "555192857993"
        },
        "msg": "teste",
        "ts": "2021-09-24T19:19:47.911Z",
        "_updatedAt": "2021-09-24T19:19:48.048Z",
        "alias": "mauricio pretto",
        "token": "do554ryecscmfrrxyxpvm",
        "unread": true,
        "urls": [],
        "mentions": [],
        "channels": [],
        "md": [
          {
            "type": "PARAGRAPH",
            "value": [
              {
                "type": "PLAIN_TEXT",
                "value": "teste"
              }
            ]
          }
        ]
      },
      {
        "_id": "2ttrNPABcCKbsbEtB",
        "t": "livechat-started",
        "msg": "",
        "groupable": false,
        "ts": "2021-09-24T19:19:46.523Z",
        "u": {
          "_id": "FWfHnJmcudrCagGDX",
          "username": "555192857993",
          "name": "555192857993"
        },
        "rid": "5qW6ssMFyzWjJev69",
        "unread": true,
        "_updatedAt": "2021-09-24T19:19:46.691Z",
        "urls": [],
        "mentions": [],
        "channels": []
      }
    ],
    "deleted": []
  },
  "success": true
}
Expand All
object
result
object
updated
Array of object
object
_id
string
rid
string
u
object
_id
string
username
string
name
string
msg
string
ts
string
_updatedAt
string
alias
string
token
string
unread
boolean
urls
Array of object
object
mentions
Array of object
object
channels
Array of object
object
md
Array of object
object
type
string
value
Array of object
object
type
string
value
string
t
string
groupable
boolean
deleted
Array of object
object
_id
string
_deletedAt
string (date-time)
cursor
object
next
string | null
previous
string | null
success
boolean
400

Bad Request

Example 1
{
  "success": false,
  "error": "The required \"roomId\" query param is missing [error-param-required]",
  "errorType": "error-param-required"
}
Example 2
{
  "success": false,
  "error": "The \"type\" or \"lastUpdate\" parameters must be provided [error-param-required]",
  "errorType": "error-param-required"
}
Example 3
{
  "success": false,
  "error": "The \"lastUpdate\" query parameter must be a valid date [error-lastUpdate-param-invalid]",
  "errorType": "error-lastUpdate-param-invalid"
}
Example 4
{
  "success": false,
  "error": "The \"fromTs\" parameter can only be used together with \"lastUpdate\" [error-fromTs-requires-lastUpdate]",
  "errorType": "error-fromTs-requires-lastUpdate"
}
object
success
boolean
error
string
errorType
string
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string