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

# Update message content via API key

> Update message content or metadata using API key authentication. Requires CHAT scope.



## OpenAPI

````yaml patch /api/chat-messages/id/{id}
openapi: 3.0.0
info:
  title: LeanMCP SDK API
  description: >-
    API endpoints for LeanMCP SDK integration. These endpoints use API key
    authentication and are designed for programmatic access from the CLI and
    SDK.
  version: 1.0.0
servers:
  - url: https://api.leanmcp.com
    description: Production
  - url: http://localhost:3001
    description: Local Development
security: []
tags:
  - name: builds-sdk
  - name: chat-messages-api-key
  - name: chats-api-key
  - name: deployments-api-key
  - name: deployments-sdk
  - name: mapping-sdk
  - name: projects-api-key
paths:
  /api/chat-messages/id/{id}:
    patch:
      tags:
        - chat-messages-api-key
      summary: Update message content via API key
      description: >-
        Update message content or metadata using API key authentication.
        Requires CHAT scope.
      operationId: ChatMessagesApiKeyController_updateMessage
      parameters:
        - name: id
          required: true
          in: path
          description: Message ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMessageContentDto'
      responses:
        '200':
          description: Message updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatMessage'
        '404':
          description: Message not found or access denied
      security:
        - ApiKeyAuth: []
components:
  schemas:
    UpdateMessageContentDto:
      type: object
      properties:
        content:
          type: string
          description: Updated message content
          example: Updated message content here
        metadata:
          type: object
          description: Updated metadata
          example:
            edited: true
            editedAt: '2025-06-16T20:00:00Z'
    ChatMessage:
      type: object
      properties:
        id:
          type: string
          description: Unique message identifier (UUID)
        chatId:
          type: string
          description: Chat ID this message belongs to (UUID)
          example: c1a83d84-7154-464c-bd19-a9f10e0a067f
        userId:
          type: string
          description: User ID who owns this message
        role:
          type: string
          enum:
            - system
            - assistant
            - user
          description: Role of the message sender
        content:
          type: string
          description: Message content/text
        messageIndex:
          type: number
          description: Order of message in the chat (0-based)
          minimum: 0
        createdAt:
          type: string
          description: Timestamp when message was created
        updatedAt:
          type: string
          description: Timestamp when message was last updated
        metadata:
          type: object
          description: Additional metadata for the message
          additionalProperties: true
      required:
        - id
        - chatId
        - userId
        - role
        - content
        - messageIndex
        - createdAt
        - updatedAt
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Enter your LeanMCP API key

````