<span id="切换-ui-协议消息点踩"></span>

# Toggle a UI protocol message dislike

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

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


```http
PUT https://api.moi.matrixorigin.cn/v5/messages/{message_id}/dislike
```

<span id="调用前准备"></span>

## 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](objects.md#prepare). This entry point uses ordinary product authentication and rejects additional task-runtime authorization headers.

<span id="请求"></span>

## Request

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

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

:::::
:::::{tab-item} Parameters

| 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.

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "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": "disliked",
        "created_at": 1794445200,
        "updated_at": 1794445200
      }
    ],
    "created_at": 1794445200,
    "updated_at": 1794445200
  }
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success; HTTP status 200. |
| `msg` | string | OK on success. |
| `data` | object | [Message object](objects.md#message-object). |

:::::
::::::
:::::::

<span id="错误响应"></span>

## Error responses

[Error formats and result confirmation](objects.md#error-contract) distinguishes session-detail not-found errors from generic service errors at other entry points.
