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

> Returns a paginated list of events (messages, handoffs, status changes, etc.) for a chat session.

# List chat session history



## OpenAPI

````yaml get /chat/sessions/{session_id}/history
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: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /chat/sessions/{session_id}/history:
    get:
      summary: List chat session history
      description: >-
        Returns a paginated list of events (messages, handoffs, status changes,
        etc.) for a chat session.
      operationId: listChatHistory
      parameters:
        - schema:
            type: string
          in: query
          name: cursor
          required: false
          description: Pagination cursor to fetch the next set of results
        - schema:
            type: string
          in: path
          name: session_id
          required: true
          description: The unique identifier of the chat session
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListChatHistoryOutput'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    ListChatHistoryOutput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ListChatHistoryOutput'
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ChatHistoryOutput'
        next:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - items
        - next
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    ChatHistoryOutput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ChatHistoryOutput'
      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:
          anyOf:
            - type: object
              properties:
                type:
                  type: string
                  const: message
                sender:
                  $ref: '#/components/schemas/ChatMessageSender'
                content:
                  type: object
                  properties:
                    type:
                      type: string
                      const: text
                    text:
                      type: string
                  required:
                    - type
                    - text
                  additionalProperties: false
                context:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
                attachments:
                  type: array
                  items:
                    $ref: '#/components/schemas/PublicChatAttachment'
              required:
                - type
                - sender
                - content
                - attachments
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: workflow_message
                workflow_id:
                  anyOf:
                    - type: string
                    - type: 'null'
                workflow_run_id:
                  anyOf:
                    - type: string
                    - type: 'null'
                content:
                  type: object
                  properties:
                    type:
                      type: string
                      const: text
                    text:
                      type: string
                  required:
                    - type
                    - text
                  additionalProperties: false
              required:
                - type
                - workflow_id
                - workflow_run_id
                - content
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: sequence_message
                sequence_id:
                  anyOf:
                    - type: string
                    - type: 'null'
                content:
                  type: object
                  properties:
                    type:
                      type: string
                      const: text
                    text:
                      type: string
                  required:
                    - type
                    - text
                  additionalProperties: false
              required:
                - type
                - sequence_id
                - content
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: handoff
                integration:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - zendesk
                        - salesforce-miaw
                  required:
                    - type
                  additionalProperties: false
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_resolved_by_agent
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_resolved_by_system
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_resolved_by_api
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_unresolved_by_agent
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_unresolved_by_system
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_unresolved_by_api
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_resolved_by_contact
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: closed_resolved_by_integration
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: sub_status_set_by_agent
                sub_status_id:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - sub_status_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: sub_status_set_by_system
                sub_status_id:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - sub_status_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: sub_status_set_by_api
                sub_status_id:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - sub_status_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: sub_status_removed_by_agent
                sub_status_id:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - sub_status_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: sub_status_removed_by_system
                sub_status_id:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - sub_status_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: sub_status_removed_by_api
                sub_status_id:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - sub_status_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: ai_resolved_issue
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: ai_assumed_issue_resolved
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: user_confirmed_issue_resolved
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: human_agent_comment
                human_agent_id:
                  type: number
                content:
                  type: object
                  properties:
                    type:
                      type: string
                      const: text
                    text:
                      type: string
                  required:
                    - type
                    - text
                  additionalProperties: false
                comment_thread_id:
                  anyOf:
                    - 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)$
                    - type: 'null'
              required:
                - type
                - human_agent_id
                - content
                - comment_thread_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: human_agent_joined
                human_agent_id:
                  type: number
              required:
                - type
                - human_agent_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: human_agent_takeover
                human_agent_id:
                  type: number
              required:
                - type
                - human_agent_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: human_agent_reopened_session
                human_agent_id:
                  type: number
              required:
                - type
                - human_agent_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: system_reopened_session
                workflow_id:
                  anyOf:
                    - type: string
                    - type: 'null'
                workflow_run_id:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - workflow_id
                - workflow_run_id
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: ai_reopened_session
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: state_checkpoint
                payload: {}
              required:
                - type
                - payload
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: csat_requested
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: csat_submitted
                payload:
                  type: object
                  properties:
                    score:
                      type: number
                    feedback:
                      anyOf:
                        - type: string
                        - type: 'null'
                  required:
                    - score
                    - feedback
                  additionalProperties: false
              required:
                - type
                - payload
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: agent_changed
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: prohibited_topic_detected
                topic:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - type
                - topic
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: agent_assigned_by_system
                assigned_agent_id:
                  type: number
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: agent_assigned_by_user
                assigned_agent_id:
                  type: number
                actor_id:
                  type: number
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: agent_unassigned_by_system
                unassigned_agent_id:
                  type: number
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: agent_unassigned_by_user
                unassigned_agent_id:
                  type: number
                actor_id:
                  type: number
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: team_assigned_by_system
                assigned_team_id:
                  type: string
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: team_assigned_by_user
                assigned_team_id:
                  type: string
                actor_id:
                  type: number
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: team_unassigned_by_system
                unassigned_team_id:
                  type: string
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  const: team_unassigned_by_user
                unassigned_team_id:
                  type: string
                actor_id:
                  type: number
              required:
                - type
              additionalProperties: false
      required:
        - id
        - created_at
        - event
      additionalProperties: false
    ChatMessageSender:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ChatMessageSender'
      anyOf:
        - type: object
          properties:
            type:
              type: string
              const: contact
            name:
              type: string
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: ai
            name:
              type: string
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: human_agent
            name:
              type: string
          required:
            - type
          additionalProperties: false
    PublicChatAttachment:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/PublicChatAttachment'
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        size:
          type: number
        type:
          type: string
        url:
          type: string
      required:
        - id
        - name
        - size
        - type
        - url
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````