> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 更新消息

> 更新特定收件箱中邮件的标签或元数据。



## OpenAPI

````yaml openapi/zh/agentmail.json PATCH /agentmail/inboxes/{inbox_id}/messages/{message_id}
openapi: 3.1.0
info:
  title: AgentMail API
  version: 1.0.0
  description: 通过 AIsa 统一网关公开的 AgentMail 电子邮件 API 端点。改编自上游 docs.agentmail.to OpenAPI 规范。
servers:
  - url: https://api.aisa.one/apis/v1
security:
  - Bearer: []
paths:
  /agentmail/inboxes/{inbox_id}/messages/{message_id}:
    patch:
      tags:
        - subpackage_inboxes.subpackage_inboxes/messages
      summary: 更新消息
      description: >-
        **CLI：**

        ```bash

        agentmail inboxes:messages update --inbox-id <inbox_id> --message-id
        <message_id> --add-label read --remove-label unread

        ```
      operationId: patch_agentmail_inboxes_inbox_id_messages_message_id
      parameters:
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes_InboxId'
        - name: message_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_messages_MessageId'
        - name: Authorization
          in: header
          description: Bearer 身份验证
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/type_messages_UpdateMessageRequest'
      responses:
        '200':
          description: 状态码为 200 的响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_messages_UpdateMessageResponse'
        '400':
          description: 状态码为 400 的错误响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type__ValidationErrorResponse'
        '404':
          description: 状态码为 404 的错误响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type__ErrorResponse'
components:
  schemas:
    type_inboxes_InboxId:
      type: string
      description: 收件箱的 ID。
      title: InboxId
    type_messages_MessageId:
      type: string
      description: 消息 ID。
      title: MessageId
    type_messages_UpdateMessageRequest:
      type: object
      properties:
        add_labels:
          $ref: '#/components/schemas/type_messages_UpdateMessageLabels'
          description: 要添加到消息的一个或多个标签。
        remove_labels:
          $ref: '#/components/schemas/type_messages_UpdateMessageLabels'
          description: 要从消息中移除的一个或多个标签。
      title: UpdateMessageRequest
    type_messages_UpdateMessageResponse:
      type: object
      properties:
        message_id:
          $ref: '#/components/schemas/type_messages_MessageId'
        labels:
          $ref: '#/components/schemas/type_messages_MessageLabels'
      required:
        - message_id
        - labels
      title: UpdateMessageResponse
    type__ValidationErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type__ErrorName'
        errors:
          description: 验证错误。
      required:
        - name
        - errors
      title: ValidationErrorResponse
    type__ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type__ErrorName'
        message:
          $ref: '#/components/schemas/type__ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
    type_messages_UpdateMessageLabels:
      oneOf:
        - type: string
        - type: array
          items:
            type: string
      description: 标签或标签列表。
      title: UpdateMessageLabels
    type_messages_MessageLabels:
      type: array
      items:
        type: string
      description: 消息标签。
      title: MessageLabels
    type__ErrorName:
      type: string
      description: 错误名称。
      title: ErrorName
    type__ErrorMessage:
      type: string
      description: 错误消息。
      title: ErrorMessage
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````