Toggle a UI protocol message like

Toggle the current user’s message rating tag and return the message record.

PUT https://api.moi.matrixorigin.cn/v5/messages/{message_id}/like

Before you call this API

Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5; use the corresponding product API URL for a dedicated deployment.

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

Request

curl --request PUT \
  "$BASE_URL/messages/$MESSAGE_ID/like" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"

Parameter

Location

Type

Required

Description

X-Workspace-ID

Headers

string

Yes

Target workspace ID.

message_id

Path

integer

Yes

Positive integer ID of the current user’s record.

If the same rating exists, remove it. Otherwise, attempt to remove the opposite rating, then add this rating. This is a toggle: repeating the same request may undo the previous result. Do not automatically retry as an idempotent setting. Read the message first if the outcome is unknown.

Successful response

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": 71,
    "user_id": "user-example",
    "session_id": 41,
    "source": "moi",
    "role": "assistant",
    "original_content": "",
    "content": "已有消息",
    "model": "",
    "status": "completed",
    "config": "",
    "response": "已有回答",
    "modified_response": "",
    "tags": [
      {
        "source": "system",
        "name": "liked",
        "created_at": 1794445200,
        "updated_at": 1794445200
      }
    ],
    "created_at": 1794445200,
    "updated_at": 1794445200
  }
}

Field

Type

Description

code

string

OK on success; HTTP status 200.

msg

string

OK on success.

data

object

Message object.

Error responses

Error formats and result confirmation distinguishes session-detail not-found errors from generic service errors at other entry points.

Last updated on