Update session¶
Update the title, status, or pinned status of a visible conversation. When archiving a session, if the session is still associated with unfinished tasks, the server will reject the request.
PATCH https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/conversations/{conversation_id}
Preparation before calling¶
First query the session list or create session] to obtain the session ID. Prepare the personal access token, target workspace ID, and session ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$CONVERSATION_ID: Session ID to update.$AGENT_ID: Optional agent filter ID.
Request example¶
curl -X PATCH "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/conversations/$CONVERSATION_ID?agent_id=$AGENT_ID" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"title": "华东销售分析",
"pinned": true
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Current workspace ID, must be consistent with |
|
string |
Yes |
The session ID to update. |
Query parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
Restrict to sessions of the specified agent. Does not filter by agent ID when not provided. |
|
string |
No |
ID of the workspace to which the agent belongs. When |
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
New session title, cannot exceed 256 characters. |
|
string |
No |
New session state, can be |
|
boolean |
No |
Whether to pin it to the top. |
Successful response¶
Returns 200 on success. data is the updated session.
{
"code": 0,
"data": {
"id": "conv_01",
"workspace_id": "ws_01",
"agent_workspace_id": "ws_01",
"agent_id": "agent_01",
"title": "华东销售分析",
"status": "active",
"purpose": "chat",
"visibility": "visible",
"pinned": true,
"created_at": "2026-01-02T15:04:05Z",
"updated_at": "2026-01-02T15:04:05Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Session ID. |
|
string |
ID of the workspace to which the session belongs. |
|
string |
ID of the workspace to which the agent belongs. |
|
string |
Agent ID. |
|
object |
Agent display summary; returned when display information is available. |
|
string |
Updated session title; not returned if not set. |
|
string |
Updated session status. |
|
string |
Session use. |
|
string |
Session visibility. |
|
boolean |
Updated top status. |
|
string |
Recent message ID; does not return if there is no message yet. |
|
string |
Current active task ID; does not return if there is no active task. |
|
string |
Last message time; does not return if there is no message yet. |
|
string |
Creation and last update times, in RFC 3339 format. |
|
string |
Creation and last update times, in RFC 3339 format. |
Error response¶
{
"code": 2,
"message": "请求参数无效",
"details": {
"cause": "conversation with an active task cannot be archived"
}
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body cannot be parsed, the header exceeds the length limit, the status is invalid, or an attempt is made to archive a session that still has unfinished tasks associated with it. |
Check fields; wait or end active tasks before archiving the session. |
|
|
The session does not exist, is not visible, or does not belong to the specified agent scope. |
Confirm session ID and agent filters. |
|
|
The server cannot update the session or generate agent display information. |
Record the request time and error message and try again. |
|
|
Session service is temporarily unavailable. |
Try again later. |
Follow-up operations¶
Call Query session details to confirm the current status of the session.