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

# Investigate a chat session by ticket number

> Investigate a chat session by ticket number — Returns an investigation bundle for a ticket, including session summary, recent history, handoff evidence, tags, CSAT, and…



## OpenAPI

````yaml get /chat/sessions/ticket/{ticket_number}/investigation
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /chat/sessions/ticket/{ticket_number}/investigation:
    get:
      summary: Investigate a chat session by ticket number
      description: >-
        Returns an investigation bundle for a ticket, including session summary,
        recent history, handoff evidence, tags, CSAT, and rule-based
        diagnostics.
      operationId: getChatSessionInvestigationByTicketNumber
      parameters:
        - schema:
            type: string
          in: path
          name: ticket_number
          required: true
          description: 'The exact ticket number, e.g. 4521 or #4521'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSessionInvestigationPublicResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    ChatSessionInvestigationPublicResponse:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ChatSessionInvestigationPublicResponse'
      type: object
      properties:
        session:
          $ref: '#/components/schemas/InvestigationSessionSummary'
        recent_history:
          type: array
          items:
            $ref: '#/components/schemas/InvestigationHistoryItem'
        history_stats:
          $ref: '#/components/schemas/InvestigationHistoryStats'
        handoff:
          $ref: '#/components/schemas/InvestigationHandoff'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/InvestigationTag'
        csat:
          $ref: '#/components/schemas/InvestigationCsat'
        diagnostics:
          type: object
          properties:
            handed_off:
              type: boolean
            likely_root_causes:
              type: array
              items:
                $ref: '#/components/schemas/InvestigationDiagnostic'
            missing_data:
              type: array
              items:
                type: string
          required:
            - handed_off
            - likely_root_causes
            - missing_data
          additionalProperties: false
        generated_at:
          type: string
          format: date-time
      required:
        - session
        - recent_history
        - history_stats
        - handoff
        - tags
        - csat
        - diagnostics
        - generated_at
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    InvestigationSessionSummary:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationSessionSummary'
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        ticket_number:
          type: number
        status:
          type: string
          enum:
            - open
            - closed_resolved
            - closed_unresolved
        ai_closure_type:
          anyOf:
            - type: string
              enum:
                - assumed_resolved
                - handed_off
                - resolved
            - type: 'null'
        sentiment:
          anyOf:
            - type: string
              enum:
                - angry
                - happy
                - neutral
            - type: 'null'
        channel:
          type: object
          properties:
            type:
              $ref: '#/components/schemas/SessionChannel'
          required:
            - type
          additionalProperties: false
        assist_mode:
          type: boolean
        language:
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        contact:
          anyOf:
            - $ref: '#/components/schemas/InvestigationContact'
            - type: 'null'
        team:
          anyOf:
            - $ref: '#/components/schemas/InvestigationTeam'
            - type: 'null'
        assignee:
          anyOf:
            - $ref: '#/components/schemas/InvestigationAssignee'
            - type: 'null'
        ticketing_system:
          anyOf:
            - $ref: '#/components/schemas/InvestigationTicketingSystem'
            - type: 'null'
      required:
        - id
        - ticket_number
        - status
        - ai_closure_type
        - sentiment
        - channel
        - assist_mode
        - language
        - created_at
        - updated_at
        - contact
        - team
        - assignee
        - ticketing_system
      additionalProperties: false
    InvestigationHistoryItem:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationHistoryItem'
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        created_at:
          type: string
          format: date-time
        event_type:
          type: string
        sender_type:
          anyOf:
            - type: string
              enum:
                - contact
                - ai
                - human_agent
            - type: 'null'
        sender_name:
          type:
            - string
            - 'null'
        text:
          type:
            - string
            - 'null'
      required:
        - id
        - created_at
        - event_type
        - sender_type
        - sender_name
        - text
      additionalProperties: false
    InvestigationHistoryStats:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationHistoryStats'
      type: object
      properties:
        total_events_loaded:
          type: number
        last_customer_message_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
        last_ai_message_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
        last_human_message_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
      required:
        - total_events_loaded
        - last_customer_message_at
        - last_ai_message_at
        - last_human_message_at
      additionalProperties: false
    InvestigationHandoff:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationHandoff'
      anyOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            created_at:
              type: string
              format: date-time
            summary:
              type: string
            explanation:
              type:
                - string
                - 'null'
            sentiment:
              anyOf:
                - type: string
                  enum:
                    - angry
                    - happy
                    - neutral
                - type: 'null'
            reasons:
              type: array
              items:
                type: string
                enum:
                  - ai_implied_handoff
                  - based_on_instructions
                  - feature_limit_reached__ai_resolutions
                  - feature_limit_reached__ai_voice_minutes
                  - instructions_not_clear
                  - insufficient_knowledge
                  - insufficient_tools
                  - prohibited_topic
                  - user_requested_human_assistance
            references:
              type: array
              items:
                $ref: '#/components/schemas/InvestigationReferenceItem'
            referenced_documents:
              $ref: '#/components/schemas/InvestigationReferenceBuckets'
          required:
            - id
            - created_at
            - summary
            - explanation
            - sentiment
            - reasons
            - references
            - referenced_documents
          additionalProperties: false
        - type: 'null'
    InvestigationTag:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationTag'
      type: object
      properties:
        tag_name:
          type: string
        created_at:
          type: string
          format: date-time
      required:
        - tag_name
        - created_at
      additionalProperties: false
    InvestigationCsat:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationCsat'
      anyOf:
        - type: object
          properties:
            id:
              type: string
            score:
              type: number
            comment:
              type:
                - string
                - 'null'
            channel:
              type:
                - string
                - 'null'
            created_at:
              type: string
              format: date-time
            updated_at:
              type: string
              format: date-time
          required:
            - id
            - score
            - comment
            - channel
            - created_at
            - updated_at
          additionalProperties: false
        - type: 'null'
    InvestigationDiagnostic:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationDiagnostic'
      type: object
      properties:
        code:
          type: string
          enum:
            - missing_instruction_or_coverage_gap
            - missing_action_or_tool
            - unclear_instruction
            - escalation_rule_triggered
            - user_requested_human
            - prohibited_topic_guardrail
        confidence:
          type: string
          enum:
            - low
            - medium
            - high
        evidence:
          type: array
          items:
            type: string
      required:
        - code
        - confidence
        - evidence
      additionalProperties: false
    SessionChannel:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SessionChannel'
      type: string
      enum:
        - web
        - email
        - phone_voice
        - slack
        - sms
        - whatsapp
        - instagram
        - messenger
        - api
        - web_voice
        - twitter
        - twitter_mentions
        - app_review
        - internal
    InvestigationContact:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationContact'
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        external_id:
          description: >-
            The contact's ID in your system, unique within your organization, or
            null when the contact was not identified by external ID. Set through
            external-ID widget authentication or the contact create/update
            endpoints.
          type:
            - string
            - 'null'
        primary_external_id:
          description: >-
            The main account's external_id within your organization, or null
            when unlinked. The main contact may not exist yet. Set through
            external-ID widget authentication or the contact create/update
            endpoints.
          type:
            - string
            - 'null'
        email:
          anyOf:
            - type: string
              format: email
              pattern: >-
                ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
            - type: 'null'
        phone_number:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        custom_data:
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties:
                type: string
            - type: 'null'
        non_verified_custom_data:
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties:
                type:
                  - string
                  - number
                  - boolean
            - type: 'null'
        created_at:
          type: string
          description: ISO 8601 timestamp of when the contact was created
        updated_at:
          type: string
          description: ISO 8601 timestamp of when the contact was last updated
        restricted_channels:
          type: array
          items:
            $ref: '#/components/schemas/RestrictableChannel'
          description: >-
            Channels this contact asked not to be contacted on: any of `email`,
            `sms`, `whatsapp`, `phone_voice`. Nothing your team, workflows,
            sequences or the API start goes out to the contact on a listed
            channel; AI replies to the contact's messages and your team's
            replies in a session on that channel are still delivered. Empty when
            nothing is restricted.
        non_verified_name:
          type:
            - string
            - 'null'
        non_verified_email:
          type:
            - string
            - 'null'
      required:
        - id
        - external_id
        - primary_external_id
        - email
        - phone_number
        - name
        - custom_data
        - non_verified_custom_data
        - created_at
        - updated_at
        - restricted_channels
        - non_verified_name
        - non_verified_email
      additionalProperties: false
    InvestigationTeam:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationTeam'
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        name:
          type: string
        description:
          type:
            - string
            - 'null'
      required:
        - id
        - name
        - description
      additionalProperties: false
    InvestigationAssignee:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationAssignee'
      type: object
      properties:
        id:
          type: number
        name:
          type:
            - string
            - 'null'
        email:
          anyOf:
            - type: string
              format: email
              pattern: >-
                ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
            - type: 'null'
        avatar_url:
          type:
            - string
            - 'null'
      required:
        - id
        - name
        - email
        - avatar_url
      additionalProperties: false
    InvestigationTicketingSystem:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationTicketingSystem'
      type: object
      properties:
        name:
          type: string
          enum:
            - dynamics365
            - freshchat
            - freshdesk
            - freshdesk_ticketing
            - front
            - genesys
            - gorgias
            - hubspot
            - infobip
            - intercom
            - jira_service_management
            - open
            - salesforce
            - salesforce_v2
            - twilio_flex
            - zendesk
            - zendesk_v2
        external_id:
          type: string
        id_type:
          type: string
          enum:
            - conversation_id
            - ticket_id
            - case_id
            - conversation_sid
      required:
        - name
        - external_id
        - id_type
      additionalProperties: false
    InvestigationReferenceItem:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationReferenceItem'
      type: object
      properties:
        reference_type:
          type: string
          enum:
            - ai_profile
            - instruction
            - knowledge
            - prohibited_topic
            - tool
        reference_id:
          type: string
      required:
        - reference_type
        - reference_id
      additionalProperties: false
    InvestigationReferenceBuckets:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/InvestigationReferenceBuckets'
      type: object
      properties:
        knowledge:
          type: array
          items:
            type: string
        tools:
          type: array
          items:
            type: string
        instructions:
          type: array
          items:
            type: string
        ai_profile:
          type: array
          items:
            type: string
        prohibited_topics:
          type: array
          items:
            type: string
      required:
        - knowledge
        - tools
        - instructions
        - ai_profile
        - prohibited_topics
      additionalProperties: false
    RestrictableChannel:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/RestrictableChannel'
      type: string
      enum:
        - email
        - sms
        - whatsapp
        - phone_voice
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.