Get the latest UI protocol message ID

Read the maximum message ID in the specified conversation for the current user.

GET https://api.moi.matrixorigin.cn/v5/messages/sessions/{session_id}/latest

Before you call this API

BASE_URL uses the product API prefix https://api.moi.matrixorigin.cn/v5. For a dedicated deployment, use its corresponding product API address.

Configure identity, workspace, and numeric record IDs in the same environment. This endpoint uses regular product authentication and rejects additional task-runtime authorization headers.

Request

curl --request GET \
  "$BASE_URL/messages/sessions/$SESSION_ID/latest" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"

Parameter

Location

Type

Required

Description

X-Workspace-ID

Header

string

Yes

Target workspace ID.

session_id

Path

integer

Yes

Positive integer record ID owned by the current user.

message_id is0 when no message matches. Conversation existence is not independently verified. This endpoint does not read completed_only; a query parameter cannot turn it into the workspace latest-message API that reads only completed messages.

Successful response

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "session_id": 41,
    "message_id": 71
  }
}

Field

Type

Description

code

string

OK on success; HTTP status200.

msg

string

OK on success.

data.session_id

integer

Conversation ID from the request.

data.message_id

integer

Maximum message ID;0 if no message matches.

Error response

Error formats and result confirmation distinguishes detail not-found from general service errors on other endpoints.

Last updated on