Get Multiple Messages From Different Rooms

Prev Next
Post
/api/v1/chat.getMessages

Fetches up to 100 messages by ID in a single request. The messages can belong to different rooms. IDs that do not match a visible message are skipped. You must have access to every room containing the requested messages.

This endpoint replaces the deprecated getMessages Realtime API method, which will be removed in 9.0.0.

Changelog

Version Description
8.9.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
Body parameters
Example
{
  "messageIds": [
    "Xq8sLpW3nZr2TmKeA",
    "Bv5nTq7RkWz3YpLcD"
  ]
}
object
messageIds
Array of string Required

The IDs of the messages to fetch.

Min items1
Max items100
Example[ "Xq8sLpW3nZr2TmKeA", "Bv5nTq7RkWz3YpLcD" ]
string
Min length1
Responses
200

OK

Success Example
{
  "messages": [
    {
      "_id": "Xq8sLpW3nZr2TmKeA",
      "rid": "6GFJ3tbmHiyHbahmC",
      "msg": "The release checklist is ready for review.",
      "ts": "2026-09-23T10:05:00.000Z",
      "u": {
        "_id": "rbAXPnMktTFbNpwtJ",
        "username": "dana.reyes",
        "name": "Dana Reyes"
      },
      "_updatedAt": "2026-09-23T10:05:00.000Z",
      "mentions": [],
      "channels": []
    },
    {
      "_id": "Bv5nTq7RkWz3YpLcD",
      "rid": "GENERAL",
      "msg": "Standup moved to 10:30 today.",
      "ts": "2026-09-22T08:15:00.000Z",
      "u": {
        "_id": "kP3wQz8LmNvT5rXyB",
        "username": "sam.okafor",
        "name": "Sam Okafor"
      },
      "_updatedAt": "2026-09-22T08:15:00.000Z",
      "mentions": [],
      "channels": []
    }
  ],
  "success": true
}
Expand All
object
messages
Array of object
object
_id
string
rid
string
msg
string
ts
string
u
object
_id
string
username
string
name
string
_updatedAt
string
mentions
Array of object
object
channels
Array of object
object
success
boolean
400

Bad Request

Missing Parameter
{
  "success": false,
  "error": "must have required property 'messageIds' [invalid-params]",
  "errorType": "invalid-params"
}
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
403

Forbidden. At least one of the messages belongs to a room you cannot access.

Permission Error
{
  "success": false,
  "error": "unauthorized"
}
object
success
boolean
error
string
404

Not Found. None of the IDs match a visible message.

Not Found
{
  "success": false,
  "error": "Resource not found"
}
object
success
boolean
error
string