---
title: "更新会话"
method: PUT
path: "/sessions/{id}"
tags: ["会话"]
---

# 更新会话

`PUT /sessions/{id}`

更新会话属性

## Path parameters

- `id` string, required

## Request body

- GithubComTencentWeKnoraInternalTypesSession
  - `created_at` string
  - `deleted_at` GormDeletedAt
    - `time` string
    - `valid` boolean — Valid is true if Time is not NULL
  - `description` string — Description
  - `id` string — ID
  - `im_platform` string — IMPlatform is the originating IM platform (e.g. "feishu", "wecom") when this session is bound to an IM channel. It is not stored on the sessions table (it lives in im_channel_sessions) and is populated on read so the Web console can classify a session's origin folder without a list query.
  - `is_pinned` boolean — IsPinned indicates whether the session is pinned in the list.
  - `last_request_state` GithubComTencentWeKnoraInternalTypesSessionLastRequestState
    - `agent_enabled` boolean
    - `agent_id` string
    - `knowledge_base_ids` string[]
    - `knowledge_ids` string[]
    - `mcp_service_ids` string[]
    - `mentioned_items` GithubComTencentWeKnoraInternalTypesMentionedItem[]
      - `id` string
      - `kb_id` string — Parent knowledge base for file/tag mentions
      - `kb_name` string — Display name for parent KB
      - `kb_type` string — "document" or "faq" (only for kb type)
      - `name` string
      - `service_id` string — Parent MCP service for MCP tool mentions
      - `skill_name` string — Preloaded agent skill name
      - `type` string — "kb", "file", "tag", "mcp", "skill"
    - `model_id` string
    - `skill_names` string[]
    - `tag_ids` string[]
    - `web_search_enabled` boolean
  - `pinned_at` string — PinnedAt records when the session was pinned; nil when not pinned.
  - `tenant_id` integer — Workspace ID
  - `title` string — Title
  - `updated_at` string
  - `user_id` string — UserID is the owner scope for this session. WeKnora user UUIDs, API external-user principals, and embed visitor principals all use this column.

## Response `200`

更新后的会话

- object

## Other responses

- `404` — 会话不存在

---

[API](https://skmtc.net/tencentblueking/apis/weknora-api.md) · [All operations](https://skmtc.net/tencentblueking/apis/weknora-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tencentblueking/weknora-api/versions/d6921ae22ce0/schema)
