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

# Get Chat

> Get chat messages by either chat ID or patient ID

Args:
    chat_id: The ID of the chat
    patient_id: The ID of the patient

Raises:
    HTTPException: If neither chat_id nor patient_id is provided



## OpenAPI

````yaml get /comms/chat/get
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /comms/chat/get:
    get:
      tags:
        - provider
        - comms
      summary: Get Chat
      description: |-
        Get chat messages by either chat ID or patient ID

        Args:
            chat_id: The ID of the chat
            patient_id: The ID of the patient

        Raises:
            HTTPException: If neither chat_id nor patient_id is provided
      operationId: get_chat_comms_chat_get_get
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
        - name: chat_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Chat Id
        - name: patient_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Patient Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatDetail'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ChatDetail:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        patients:
          items:
            $ref: '#/components/schemas/ChatPatient'
          type: array
          title: Patients
          default: []
        status:
          anyOf:
            - $ref: '#/components/schemas/ChatStatus'
            - type: 'null'
        optedOutOfSms:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Optedoutofsms
        messages:
          items:
            anyOf:
              - $ref: '#/components/schemas/MessageSummary'
              - $ref: '#/components/schemas/CallSummary'
          type: array
          title: Messages
          default: []
      type: object
      title: ChatDetail
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatPatient:
      properties:
        id:
          type: string
          title: Id
        firstName:
          anyOf:
            - type: string
            - type: 'null'
          title: Firstname
        lastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Lastname
        primaryLocationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Primarylocationid
      type: object
      required:
        - id
        - firstName
        - lastName
        - primaryLocationId
      title: ChatPatient
    ChatStatus:
      type: string
      enum:
        - READ
        - UNREAD
      title: ChatStatus
    MessageSummary:
      properties:
        id:
          type: string
          title: Id
        messageUid:
          anyOf:
            - type: string
            - type: 'null'
          title: Messageuid
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
        chatId:
          type: string
          title: Chatid
        status:
          $ref: '#/components/schemas/MessageStatus'
        errorMessage:
          anyOf:
            - type: string
            - type: 'null'
          title: Errormessage
        sendoMessageId:
          anyOf:
            - type: string
            - type: 'null'
          title: Sendomessageid
        sender:
          $ref: '#/components/schemas/UserTiny'
        functionCall:
          anyOf:
            - type: object
            - type: 'null'
          title: Functioncall
        createdDate:
          type: string
          format: date-time
          title: Createddate
        files:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Files
          default: []
        suggestedMessages:
          anyOf:
            - items:
                $ref: '#/components/schemas/SuggestedMessageSummary'
              type: array
            - type: 'null'
          title: Suggestedmessages
        toolCalls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolCallSummary'
              type: array
            - type: 'null'
          title: Toolcalls
        eventId:
          anyOf:
            - type: string
            - type: 'null'
          title: Eventid
        type:
          anyOf:
            - $ref: '#/components/schemas/MessageType'
            - type: 'null'
      type: object
      required:
        - id
        - chatId
        - status
        - sender
        - createdDate
      title: MessageSummary
    CallSummary:
      properties:
        id:
          type: string
          title: Id
        sender:
          anyOf:
            - $ref: '#/components/schemas/UserTiny'
            - type: 'null'
        receiver:
          anyOf:
            - $ref: '#/components/schemas/UserTiny'
            - type: 'null'
        chatId:
          type: string
          title: Chatid
        direction:
          $ref: '#/components/schemas/CallDirection'
        status:
          $ref: '#/components/schemas/CallStatus'
        completedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completeddate
        retellCallId:
          anyOf:
            - type: string
            - type: 'null'
          title: Retellcallid
        disconnectionReason:
          anyOf:
            - type: string
            - type: 'null'
          title: Disconnectionreason
        pathToAudio:
          anyOf:
            - type: string
            - type: 'null'
          title: Pathtoaudio
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
        context:
          anyOf:
            - type: object
            - type: 'null'
          title: Context
        createdDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Createddate
        toolCalls:
          items:
            $ref: '#/components/schemas/ToolCall'
          type: array
          title: Toolcalls
          default: []
        tags:
          items:
            $ref: '#/components/schemas/TagSummary'
          type: array
          title: Tags
          default: []
        invoiceId:
          anyOf:
            - type: string
            - type: 'null'
          title: Invoiceid
        type:
          $ref: '#/components/schemas/CallType'
          default: MANUAL
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
      type: object
      required:
        - id
        - chatId
        - direction
        - status
      title: CallSummary
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    MessageStatus:
      type: string
      enum:
        - CREATED
        - QUEUED
        - SCHEDULED
        - SENDING
        - SENT
        - UNDELIVERED
        - DELIVERED
        - READ
        - FAILED
        - EXPIRED
        - OPTED_OUT
      title: MessageStatus
    UserTiny:
      properties:
        id:
          type: string
          title: Id
          description: The unique identifier for the user.
        firstName:
          anyOf:
            - type: string
            - type: 'null'
          title: Firstname
          description: The user's first name.
        lastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Lastname
          description: The user's last name.
        phoneNumber:
          anyOf:
            - type: string
            - type: 'null'
          title: Phonenumber
          description: The user's phone number.
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: The user's email address.
        type:
          $ref: '#/components/schemas/UserType'
          description: The type of user.
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
          description: The location of the user.
      type: object
      required:
        - id
        - type
      title: UserTiny
    SuggestedMessageSummary:
      properties:
        id:
          type: string
          title: Id
        chatId:
          type: string
          title: Chatid
        fromMessageId:
          type: string
          title: Frommessageid
        content:
          type: string
          title: Content
        assistantId:
          type: string
          title: Assistantid
        isSelected:
          type: boolean
          title: Isselected
        createdDate:
          type: string
          format: date-time
          title: Createddate
      type: object
      required:
        - id
        - chatId
        - fromMessageId
        - content
        - assistantId
        - isSelected
        - createdDate
      title: SuggestedMessageSummary
    ToolCallSummary:
      properties:
        id:
          type: string
          title: Id
        callId:
          anyOf:
            - type: string
            - type: 'null'
          title: Callid
        messageId:
          anyOf:
            - type: string
            - type: 'null'
          title: Messageid
        alertId:
          anyOf:
            - type: string
            - type: 'null'
          title: Alertid
        toolName:
          type: string
          title: Toolname
        toolArguments:
          type: object
          title: Toolarguments
        toolCallId:
          anyOf:
            - type: string
            - type: 'null'
          title: Toolcallid
        result:
          anyOf:
            - type: object
            - type: 'null'
          title: Result
        toolCallDescription:
          anyOf:
            - type: string
            - type: 'null'
          title: Toolcalldescription
        hasBeenCalled:
          type: boolean
          title: Hasbeencalled
          default: false
        createdDate:
          type: string
          format: date-time
          title: Createddate
      type: object
      required:
        - id
        - toolName
        - toolArguments
        - createdDate
      title: ToolCallSummary
    MessageType:
      type: string
      enum:
        - REMINDER
        - OVERRIDE
        - FOLLOW_UP
        - EXPIRED
        - CONFIRMATION
        - INTRODUCTORY
        - CANCELLED
        - UPDATE
      title: MessageType
    CallDirection:
      type: string
      enum:
        - INBOUND
        - OUTBOUND
      title: CallDirection
    CallStatus:
      type: string
      enum:
        - CREATED
        - ONGOING
        - TRANSFERRED
        - DISCONNECTED
        - FAILED
        - FINISHED
        - VOICEMAIL
      title: CallStatus
    ToolCall:
      properties:
        id:
          type: string
          title: Id
        toolName:
          type: string
          title: Toolname
        toolArguments:
          type: object
          title: Toolarguments
        toolCallId:
          anyOf:
            - type: string
            - type: 'null'
          title: Toolcallid
      type: object
      required:
        - id
        - toolName
        - toolArguments
      title: ToolCall
    TagSummary:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        useForAlerts:
          type: boolean
          title: Useforalerts
        useForCalls:
          type: boolean
          title: Useforcalls
        id:
          type: string
          title: Id
      type: object
      required:
        - name
        - useForAlerts
        - useForCalls
        - id
      title: TagSummary
    CallType:
      type: string
      enum:
        - MANUAL
        - AI
      title: CallType
    UserType:
      type: string
      enum:
        - PROVIDER
        - PATIENT
        - ASSISTANT
      title: UserType

````