Skip to main content
GET
/
api
/
v1
/
usage-analyst
/
chat-messages
Get all chat messages from sessions for user or group
const url = 'https://studyfetchapi.com/api/v1/usage-analyst/chat-messages';
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}, body: undefined};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
{
  "messages": [
    {
      "sessionId": "<string>",
      "userId": "<string>",
      "componentId": "<string>",
      "role": "user",
      "content": "<string>",
      "createdAt": "2023-11-07T05:31:56Z",
      "metadata": {}
    }
  ],
  "total": 123,
  "sessionCount": 123
}

Authorizations

x-api-key
string
header
required

API Key for authentication

Query Parameters

userId
string

User ID to get chat messages for

groupIds
string[]

Array of group IDs to filter

Example:
["class-101", "class-102"]

Response

200 - application/json

Chat messages retrieved successfully

messages
object[]
total
number
sessionCount
number
I