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

# Patch Chat Thread Entry



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/sgp/openapi.yml patch /v4/threads/{thread_id}/messages/{application_interaction_id}
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/threads/{thread_id}/messages/{application_interaction_id}:
    patch:
      tags:
        - ChatThreads
      summary: Patch Chat Thread Entry
      operationId: PATCH-V4-/threads/{thread_id}/messages/{application_interaction_id}
      parameters:
        - name: thread_id
          in: path
          required: true
          schema:
            type: string
            title: Thread Id
        - name: application_interaction_id
          in: path
          required: true
          schema:
            title: Application Interaction Id
            type: string
        - name: fetch_by_account
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Fetch the thread by account instead of user
            default: false
            title: Fetch By Account
          description: Fetch the thread by account instead of user
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChatThreadEntryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationInteractionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from scale_gp import SGPClient

            client = SGPClient(
                api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
            )
            message = client.chat_threads.messages.update(
                application_interaction_id="application_interaction_id",
                thread_id="thread_id",
            )
            print(message.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/stainless-sdks/sgp-go\"\n\t\"github.com/stainless-sdks/sgp-go/option\"\n)\n\nfunc main() {\n\tclient := sgp.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmessage, err := client.ChatThreads.Messages.Update(\n\t\tcontext.TODO(),\n\t\t\"thread_id\",\n\t\t\"application_interaction_id\",\n\t\tsgp.ChatThreadMessageUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", message.ID)\n}\n"
components:
  schemas:
    UpdateChatThreadEntryRequest:
      properties:
        output_text:
          title: Output Text
          description: ' The output text generated by the application.'
          type: string
      type: object
      title: UpdateChatThreadEntryRequest
    ApplicationInteractionResponse:
      properties:
        id:
          type: string
          title: Id
        input:
          additionalProperties: true
          type: object
          title: Input
        output:
          additionalProperties: true
          type: object
          title: Output
        aggregated:
          type: boolean
          title: Aggregated
          description: >-
            Boolean of whether this interaction has been uploaded to s3 bucket
            yet, default is false
          can_patch: false
        application_spec_id:
          type: string
          title: Application Spec Id
        application_variant_id:
          type: string
          title: Application Variant Id
        start_timestamp:
          type: string
          format: date-time
          title: Start Timestamp
        duration_ms:
          type: integer
          title: Duration Ms
          description: How much time the step took in milliseconds(ms)
        operation_status:
          $ref: '#/components/schemas/ApplicationOperationStatus'
          description: The outcome of the operation
        operation_metadata:
          title: Operation Metadata
          description: >-
            The JSON representation of the metadata insights emitted through the
            execution. This can differ based on different types of operations
          additionalProperties: true
          type: object
        models:
          title: Models
          description: The models used for this interaction
          items:
            type: string
          type: array
        chat_thread_id:
          title: Chat Thread Id
          can_patch: false
          type: string
        interaction_source:
          $ref: '#/components/schemas/ApplicationInteractionSource'
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time when the entity was created in ISO format.
      type: object
      required:
        - id
        - input
        - output
        - aggregated
        - application_spec_id
        - application_variant_id
        - start_timestamp
        - duration_ms
        - operation_status
        - created_at
      title: ApplicationInteractionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ApplicationOperationStatus:
      type: string
      enum:
        - SUCCESS
        - ERROR
        - CANCELED
      title: ApplicationOperationStatus
    ApplicationInteractionSource:
      type: string
      enum:
        - EXTERNAL_AI
        - EVALUATION
        - SGP_CHAT
        - AGENTS_SERVICE
      title: ApplicationInteractionSource
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````