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 the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $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

workspace_id

string

Yes

Current workspace ID, must be consistent with X-Workspace-ID.

conversation_id

string

Yes

The session ID to update.

Query parameters

Parameters

Type

Is it required

Description

agent_id

string

No

Restrict to sessions of the specified agent. Does not filter by agent ID when not provided.

agent_workspace_id

string

No

ID of the workspace to which the agent belongs. When agent_id is specified without this parameter, the current workspace is used; only the current workspace or the system workspace can be specified.

Request body

Parameters

Type

Is it required

Description

title

string

No

New session title, cannot exceed 256 characters.

status

string

No

New session state, can be active or archived.

pinned

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

code

integer

0 on success.

data.id

string

Session ID.

data.workspace_id

string

ID of the workspace to which the session belongs.

data.agent_workspace_id

string

ID of the workspace to which the agent belongs.

data.agent_id

string

Agent ID.

data.agent_summary

object

Agent display summary; returned when display information is available.

data.title

string

Updated session title; not returned if not set.

data.status

string

Updated session status.

data.purpose

string

Session use.

data.visibility

string

Session visibility.

data.pinned

boolean

Updated top status.

data.head_message_id

string

Recent message ID; does not return if there is no message yet.

data.active_task_id

string

Current active task ID; does not return if there is no active task.

data.last_message_at

string

Last message time; does not return if there is no message yet.

data.created_at

string

Creation and last update times, in RFC 3339 format.

data.updated_at

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

400

2INVALID_ARGUMENT

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.

404

3NOT_FOUND

The session does not exist, is not visible, or does not belong to the specified agent scope.

Confirm session ID and agent filters.

500

1INTERNAL

The server cannot update the session or generate agent display information.

Record the request time and error message and try again.

503

15UNAVAILABLE

Session service is temporarily unavailable.

Try again later.

Follow-up operations

Call Query session details to confirm the current status of the session.

Last updated on