<span id="重命名团队会话"></span>

# Rename a team conversation

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

Change the name of the specified team conversation.


```http
PATCH https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agent-teams/{team_id}/sessions/{context_id}
```

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

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

[Prepare product identity and object identifiers in the same environment](objects.md#prepare).

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

## Request

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

```bash
curl --request PATCH \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agent-teams/$TEAM_ID/sessions/$CONTEXT_ID" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data '{"name":"资料核对","expected_version":1}'
```

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

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | Path | string | Yes | Current Workspace ID, consistent with the product identity and request headers in the same environment. |
| `team_id` | Path | string | Yes | Team ID from the team list or creation response. |
| `context_id` | Path | string | Yes | Team conversation ID from creation or the list. |
| `name` | Body | string | Yes | Nonempty conversation name. |
| `expected_version` | Body | integer | Yes | Current conversation version. |

Use this conversation's own version. The trimmed name must be nonempty; expected_version must be positive and match. Renaming does not reset active_task_id, pending_ingress_id, or provider sessions.

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

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

## Successful response

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

```json
{
  "code": 0,
  "data": {
    "workspace_id": "workspace-example",
    "team_id": "team-example",
    "context_id": "context-example",
    "name": "资料核对",
    "created_by_moi_user_id": "user-example",
    "updated_by_moi_user_id": "user-example",
    "version": 2,
    "created_at": "2026-11-12T01:00:00Z",
    "updated_at": "2026-11-12T01:00:00Z"
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | [Corresponding response object](objects.md#responses). |

HTTP 200. Returns the [corresponding object](objects.md#responses); confirm writes with the corresponding read operation.

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

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

## Error response

[Errors and concurrency handling](lifecycle.md#errors) distinguishes parameter, version, member/conversation state, and admission failures.
