Skip to main content

aiThreadsReadMessages

List aiThreadsReadMessages(threadId, count, cursor, direction)

GET /api/2.0/ai/threads/read-messages

Read messages

Reads the messages of one thread, oldest first, with the same string-encoded JSON cursor as the thread list. direction turns the read around, and only the exact value desc does so - anything else, including a misspelling, reads forward. Omitting threadId is not an error: the call answers 200 with an empty list, so an empty result does not distinguish a thread with no messages from a request that forgot the ID. A malformed cursor is ignored and the read starts from the beginning.

Parameters​

NameInTypeDescriptionNotes
threadIdqueryStringThe chat thread identifier.[required] [example: 11111111-1111-1111-1111-111111111111]
countqueryIntegerThe maximum number of items to return in one page.[optional] [example: 20]
cursorqueryStringThe keyset pagination cursor: the JSON-encoded sort key of the last item already received. Omit for the first page.[optional] [example: {"id":"11111111-1111-1111-1111-111111111111","lastEditDate":1767225600000}]
directionqueryStringThe order the message page is read in. Only desc turns the read around and pages back from the newest message; omit for the forward read.[optional] [example: desc]

Responses​

Status codeDescriptionTypeResponse headers
200The thread's messages, oldest first unless direction reversed them. An empty list also means the request carried no thread ID.List-
401Missing asc_auth_key cookie or Authorization header.AiErrorResponse-
403AI is disabled for this portal, the caller is a guest, or the room named by entityId is one the caller cannot open. Relayed from the DocSpace AI service or the Files API.AiErrorResponse-
500Unhandled failure. The reason is logged server-side and never echoed back.AiErrorResponse-

Return type​

List

Authorization​

cookieAuth, bearerAuth

HTTP request headers​

  • Content-Type: Not defined
  • Accept: application/json