---
title: "编辑消息"
method: PATCH
path: "/messages/{conversationId}/{messageId}"
tags: ["Messages"]
---

# 编辑消息

`PATCH /messages/{conversationId}/{messageId}`

只能编辑自己发送的消息

## Path parameters

- `conversationId` string, required
- `messageId` string, required

## Request body

- object
  - `content` string
  - `metadata` object

## Response `200`

更新成功

- MessageResponse
  - `ok` boolean
  - `data` Message
    - `id` string
    - `conversationId` string
    - `senderId` string
    - `type` 'text' | 'markdown' | 'code' | 'image' | 'file' | 'tool_call' | 'tool_result' | 'system_event' | 'thinking' — 消息类型: - `text`: 纯文本 - `markdown`: Markdown 格式 - `code`: 代码块 - `image`: 图片 - `file`: 文件 - `tool_call`: 工具调用 - `tool_result`: 工具结果 - `system_event`: 系统事件 - `thinking`: Agent 思考过程
    - `content` string
    - `metadata` MessageMetadata — 消息元数据 (根据消息类型不同)
      - `language` string — 代码语言 (type=code 时)
      - `fileName` string
      - `fileSize` integer
      - `mimeType` string
      - `fileUrl` string, uri
      - `toolCall` ToolCallPayload — 工具调用载荷
        - `callId` string — 调用 ID (用于关联结果)
        - `toolName` string — 工具名称
        - `arguments` object — 调用参数
      - `toolResult` ToolResultPayload — 工具调用结果
        - `callId` string — 关联的调用 ID
        - `toolName` string
        - `result` unknown
        - `isError` boolean — 是否为错误
      - `systemEvent` object
        - `event` string
        - `data` object
      - `isStreaming` boolean
      - `streamId` string
      - `thinkingStep` integer
    - `parentId` string
    - `status` 'sending' | 'sent' | 'delivered' | 'read' | 'failed' — 消息状态
    - `createdAt` string, date-time
    - `updatedAt` string, date-time

## Other responses

- `401` — 未认证或 Token 无效
- `403` — 无权限
- `404` — 资源不存在

---

[API](https://skmtc.net/prismer-ai/apis/prismer-im-server-api.md) · [All operations](https://skmtc.net/prismer-ai/apis/prismer-im-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/prismer-ai/prismer-im-server-api/revisions/b27b5d973513/schema)
