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

# Update Thread Message

> Updates the metadata of a specific message within a thread.

This endpoint allows you to update the metadata of a specific message within a thread. It's useful for adding or modifying additional information associated with a message without changing its core content.


## OpenAPI

````yaml POST /v2/threads/{threadId}/messages/{messageId}
openapi: 3.0.0
info:
  version: 1.0.0
  title: Langtail prompt endpoint
servers: []
security: []
paths:
  /v2/threads/{threadId}/messages/{messageId}:
    post:
      description: Updates the metadata of a specific message within a thread.
      parameters:
        - schema:
            type: string
            example: <LANGTAIL_API_KEY>
          required: true
          description: Your Langtail API Key
          name: X-API-Key
          in: header
        - name: threadId
          in: path
          required: true
          description: The ID of the thread containing the message.
          schema:
            type: string
        - name: messageId
          in: path
          required: true
          description: The ID of the message to update.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                metadata:
                  type: object
                  description: >-
                    Set of key-value pairs that you can attach to the message.
                    This can be useful for storing additional information about
                    the message in a structured format.
                  example:
                    my_key: my key value
              required:
                - metadata
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The unique identifier for the message.
                  createdAt:
                    type: string
                    format: date-time
                    description: The timestamp when the message was created.
                  deletedAt:
                    type: string
                    format: date-time
                    description: The timestamp when the message was deleted.
                    nullable: true
                  threadId:
                    type: string
                    description: The ID of the thread this message belongs to.
                  content:
                    type: array
                    items:
                      type: object
                      properties:
                        role:
                          type: string
                          enum:
                            - assistant
                            - user
                            - system
                            - function
                            - tool
                        content:
                          anyOf:
                            - type: string
                              description: Text content
                              nullable: false
                            - type: array
                              description: Mix of text and images.
                              items:
                                anyOf:
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - text
                                      text:
                                        type: string
                                    required:
                                      - type
                                      - text
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - image_url
                                      image_url:
                                        type: object
                                        properties:
                                          url:
                                            type: string
                                          detail:
                                            type: string
                                            enum:
                                              - auto
                                              - low
                                              - high
                                            default: auto
                                        required:
                                          - url
                                          - detail
                                    required:
                                      - type
                                      - image_url
                            - nullable: true
                              description: >-
                                Can be omited if there is a `function_call` or
                                `tool_calls`
                        function_call:
                          type: object
                          properties:
                            name:
                              type: string
                            arguments:
                              type: string
                          required:
                            - name
                            - arguments
                        tool_calls:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              type:
                                type: string
                                enum:
                                  - function
                              function:
                                type: object
                                properties:
                                  name:
                                    type: string
                                  arguments:
                                    type: string
                                required:
                                  - name
                                  - arguments
                            required:
                              - id
                              - type
                              - function
                        tool_choice:
                          anyOf:
                            - type: string
                              enum:
                                - auto
                            - type: string
                              enum:
                                - none
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - function
                                function:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                  required:
                                    - name
                              required:
                                - type
                                - function
                        tool_call_id:
                          type: string
                      required:
                        - role
                        - content
                    description: >-
                      Additional messages. These will be appended to the Prompt
                      Template.
                    example:
                      - role: user
                        content: Hello
                  metadata:
                    type: object
                    description: >-
                      A set of key-value pairs that can be attached to the
                      message.
                    nullable: true
                    example:
                      my_key: my key value
                  requestLogId:
                    type: string
                    nullable: true
                    description: The ID of the associated request log, if available.
                required:
                  - id
                  - createdAt
                  - threadId
                  - metadata
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Metadata is required
                required:
                  - error
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Message not found
                required:
                  - error
      servers:
        - url: https://api.langtail.com

````