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

# Get Conversation Graph

> Return the conversation family of a thread as a read-only DAG.

Nodes are completed user turns (one per workspace snapshot), edges are
sequential turns within a thread or fork points between threads. The
response includes every thread in the family so empty branches can be
rendered as stubs.

Args:
    user:      The authenticated user (must own the requested thread).
    thread_id: The thread whose family to render.
    db:        Database session.

Returns:
    The ``ConversationGraphResponse`` DAG payload.

Raises:
    HTTPException 403: The conversation belongs to another user.
    HTTPException 404: Unknown conversation.



## OpenAPI

````yaml /openapi.json get /api/conversations/{thread_id}/graph
openapi: 3.1.0
info:
  title: HAI-Co² API
  description: Human-AI Co-Construction reference implementation.
  version: 0.1.0
servers:
  - url: https://haico.gr
    description: Production
  - url: https://dev.haico.gr
    description: Development
  - url: http://localhost:8000
    description: Local development
security: []
paths:
  /api/conversations/{thread_id}/graph:
    get:
      tags:
        - Conversations
      summary: Get Conversation Graph
      description: |-
        Return the conversation family of a thread as a read-only DAG.

        Nodes are completed user turns (one per workspace snapshot), edges are
        sequential turns within a thread or fork points between threads. The
        response includes every thread in the family so empty branches can be
        rendered as stubs.

        Args:
            user:      The authenticated user (must own the requested thread).
            thread_id: The thread whose family to render.
            db:        Database session.

        Returns:
            The ``ConversationGraphResponse`` DAG payload.

        Raises:
            HTTPException 403: The conversation belongs to another user.
            HTTPException 404: Unknown conversation.
      operationId: get_conversation_graph_api_conversations__thread_id__graph_get
      parameters:
        - name: thread_id
          in: path
          required: true
          schema:
            type: string
            maxLength: 255
            minLength: 1
            title: Thread Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationGraphResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ConversationGraphResponse:
      properties:
        root_thread_id:
          type: string
          title: Root Thread Id
        requested_thread_id:
          type: string
          title: Requested Thread Id
        nodes:
          items:
            $ref: '#/components/schemas/GraphNodeSchema'
          type: array
          title: Nodes
        edges:
          items:
            $ref: '#/components/schemas/GraphEdgeSchema'
          type: array
          title: Edges
        threads:
          items:
            $ref: '#/components/schemas/GraphThreadSchema'
          type: array
          title: Threads
        truncated:
          type: boolean
          title: Truncated
          default: false
      type: object
      required:
        - root_thread_id
        - requested_thread_id
        - nodes
        - edges
        - threads
      title: ConversationGraphResponse
      description: The whole conversation family rendered as a DAG.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GraphNodeSchema:
      properties:
        id:
          type: string
          title: Id
        thread_id:
          type: string
          title: Thread Id
        turn_index:
          type: integer
          title: Turn Index
        user_message:
          anyOf:
            - type: string
            - type: 'null'
          title: User Message
        assistant_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Assistant Summary
        reasoning_steps:
          type: integer
          title: Reasoning Steps
          default: 0
        captured_at:
          type: string
          format: date-time
          title: Captured At
        artifact_count:
          type: integer
          title: Artifact Count
        is_latest_in_thread:
          type: boolean
          title: Is Latest In Thread
        is_on_active_path:
          type: boolean
          title: Is On Active Path
      type: object
      required:
        - id
        - thread_id
        - turn_index
        - captured_at
        - artifact_count
        - is_latest_in_thread
        - is_on_active_path
      title: GraphNodeSchema
      description: One completed user turn in the conversation family graph.
    GraphEdgeSchema:
      properties:
        id:
          type: string
          title: Id
        source:
          type: string
          title: Source
        target:
          type: string
          title: Target
        kind:
          type: string
          title: Kind
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
      type: object
      required:
        - id
        - source
        - target
        - kind
      title: GraphEdgeSchema
      description: A directed edge between two graph nodes.
    GraphThreadSchema:
      properties:
        thread_id:
          type: string
          title: Thread Id
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        parent_thread_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Thread Id
        branch_point_turn:
          anyOf:
            - type: integer
            - type: 'null'
          title: Branch Point Turn
        created_at:
          type: string
          format: date-time
          title: Created At
        is_current:
          type: boolean
          title: Is Current
      type: object
      required:
        - thread_id
        - created_at
        - is_current
      title: GraphThreadSchema
      description: One thread of the conversation family, including empty branch stubs.
    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
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      description: >-
        A personal access token (`haico_pat_...`), created under Profile → API
        keys. Send it as `Authorization: Bearer <key>`. The browser session JWT
        is also accepted but is an internal mechanism and is not part of the
        public contract.
      scheme: bearer

````