> ## 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.

# Delete Thread Message

> Deletes a message by its ID.

This endpoint allows you to delete specific message within a thread.

It's useful if your thread gets too large for LLM's context.


## OpenAPI

````yaml DELETE /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}:
    delete:
      description: Deletes a message by its ID.
      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 retrieve.
          schema:
            type: string
      responses:
        '200':
          description: Successfully deleted message
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The unique identifier of the deleted message.
                  object:
                    type: string
                    description: >-
                      The object type, which is always 'thread.message.deleted'
                      for this response.
                    example: thread.message.deleted
                  deleted:
                    type: boolean
                    description: Indicates that the message was successfully deleted.
                    example: true
                required:
                  - id
                  - object
                  - deleted
        '404':
          description: Message not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        example: >-
                          Message not found or does not belong to the proper
                          thread/project
                required:
                  - error
      servers:
        - url: https://api.langtail.com

````