<span id="更新-ui-协议会话记录"></span>

# Update a UI protocol session record

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

Update the current user's session with a nonempty title or configuration text.


```http
PUT https://api.moi.matrixorigin.cn/v5/sessions/{session_id}
```

<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/sessions/$SESSION_ID" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data-raw '{"title":"更新后的标题"}'
```

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

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Workspace-ID` | Headers | string | Yes | Target workspace ID. |
| `session_id` | Path | integer | Yes | Positive integer ID of the current user's record. |
| `title` | Body | string | No | Updates only for a nonempty string; an empty value retains the original title. |
| `config` | Body | string | No | Updates only for a nonempty string; an empty value retains the original configuration. |
| `source` | Body | string | No | Accepted during binding but not used for the update. |
| `tags` | Body | array (strings) | No | Accepted during binding but does not update tag relationships. |

This UI entry point does not read expected_title or implement the workspace update entry point's original-title condition. Omission, null, or an empty string does not clear title/config. Compare returned values and read details after changing them. These rules do not apply to the workspace entry point with expected_title.

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

<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": 41,
    "title": "更新后的标题",
    "source": "moi",
    "user_id": "user-example",
    "config": "{}",
    "tags": [],
    "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 | [Session object](objects.md#session-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.
