---
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
  - `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[]
    - `model_id` string
    - `web_search_enabled` boolean
  - `pinned_at` string — PinnedAt records when the session was pinned; nil when not pinned.
  - `tenant_id` integer — Tenant ID
  - `title` string — Title
  - `updated_at` string
  - `user_id` string — UserID is the owner of the session. Empty for legacy rows (visible at tenant level) and for IM-created sessions that do not map to a WeKnora user.

## Response `200`

更新后的会话

- object

## Other responses

- `404` — 会话不存在

## Changes

- **2025-12-22** `e625bcd5b8b9` — 1 info
  - the endpoint scheme security `ApiKeyAuth` was added to the API
- **2025-12-16** `edf61e68559d` — 1 info
  - the endpoint scheme security `ApiKeyAuth` was removed from the API

[Change history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/sessions/:id/put.md)

---

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