---
title: "修改会话"
method: PATCH
path: "/api/ai/agent/sessions/{sessionId}"
tags: ["AI 服务/Agent"]
---

# 修改会话

`PATCH /api/ai/agent/sessions/{sessionId}`

## Request

- Base URL: `https://aitoearn.cn`
- URL: `https://aitoearn.cn/api/ai/agent/sessions/{sessionId}`
- Auth: API key in header `X-Api-Key`
- TypeScript: <https://skmtc.dev/aitoearn/apis/aitoearn-api/docs/api/ai/agent/sessions/:sessionId/patch.ts> (a function with typed inputs; its response is checked against the schema)

修改会话标题。标题长度为 1-100。

## Path parameters

- `sessionId` string, required: 会话 ID。

## Request body

- object
  - `title` string, required: 会话标题，长度 1-100。

## Response `200`

请求已被服务处理。业务是否成功以响应体 code === 0 为准。

- object
  - `data` object
    - `id` string, required: 会话 ID。
    - `title` string: 会话标题。新会话标题生成后才会出现。
    - `status` 'active' | 'waiting_approval' | 'waiting_task' | 'waiting_resume' | 'completed' | 'cancelled', required: 会话状态。active 为进行中，waiting_approval 为等待工具审批，waiting_task 为等待异步任务，waiting_resume 为等待续跑，completed 为已完成，cancelled 为已中止。
    - `points` number, required: 该会话累计消耗的积分。
    - `createdAt` string, date-time, required: 创建时间。
    - `updatedAt` string, date-time, required: 更新时间。
  - `code` integer, required: 业务状态码。0 表示成功，非 0 表示业务错误。
  - `message` string, required: 响应消息。
  - `requestId` string: 请求 ID。
  - `timestamp` integer: 错误响应时间戳，Unix 毫秒。

## Changes

- **2026-11-03** `7cc8f21c4c96`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/aitoearn/apis/aitoearn-api/changes/api/ai/agent/sessions/:sessionId/patch.md)

---

[API](https://skmtc.dev/aitoearn/apis/aitoearn-api.md) - [All operations](https://skmtc.dev/aitoearn/apis/aitoearn-api/llms.txt) - [OpenAPI document](https://skmtc.dev/aitoearn/apis/aitoearn-api/revisions/7cc8f21c4c96?raw)
