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

# Get Path Part Ancestry Handler

> Get the full ancestry chain for a path part (root to leaf, inclusive).

Returns all ancestors from the root down to and including the target
path part. Authorization is checked on the leaf — if the user can
read the leaf, they can navigate its ancestors.



## OpenAPI

````yaml /openapi.yaml get /v1/path-parts/{path_part_id}/ancestry
openapi: 3.1.0
info:
  title: Knowledge Stack API
  description: Knowledge Stack backend API for authentication and knowledge management
  version: 0.1.0
servers:
  - url: http://localhost:8000
    description: Knowledge Stack API local dev server
security: []
tags:
  - name: auth
    description: Authentication and identity management
  - name: users
    description: User accounts
  - name: tenants
    description: Tenant management
  - name: invites
    description: Tenant invitations
  - name: folders
    description: Folder management
  - name: documents
    description: Document management
  - name: document-versions
    description: Document version management
  - name: sections
    description: Document sections
  - name: chunks
    description: Chunk CRUD and semantic search
  - name: chunk-lineages
    description: Chunk lineage tracking
  - name: tags
    description: Tag management
  - name: path-parts
    description: Path part traversal and tagging
  - name: Threads
    description: Thread conversations
  - name: Thread Messages
    description: Thread message management
  - name: user-permissions
    description: User path permissions
  - name: workflows
    description: Ingestion workflows
paths:
  /v1/path-parts/{path_part_id}/ancestry:
    get:
      tags:
        - path-parts
      summary: Get Path Part Ancestry Handler
      description: |-
        Get the full ancestry chain for a path part (root to leaf, inclusive).

        Returns all ancestors from the root down to and including the target
        path part. Authorization is checked on the leaf — if the user can
        read the leaf, they can navigate its ancestors.
      operationId: get_path_part_ancestry
      parameters:
        - name: path_part_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Path Part Id
        - name: authorization
          in: header
          required: false
          schema:
            type: string
            nullable: true
            title: Authorization
        - name: ks_uat
          in: cookie
          required: false
          schema:
            type: string
            nullable: true
            title: Ks Uat
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AncestryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AncestryResponse:
      properties:
        ancestors:
          items:
            $ref: '#/components/schemas/PathPartAncestorItem'
          type: array
          title: Ancestors
          description: Ancestors ordered root-to-leaf
      additionalProperties: false
      type: object
      required:
        - ancestors
      title: AncestryResponse
      description: Response containing the ancestry chain from root to target (inclusive).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PathPartAncestorItem:
      properties:
        path_part_id:
          type: string
          format: uuid
          title: Path Part Id
          description: PathPart ID
        name:
          type: string
          title: Name
          description: Item name
        part_type:
          $ref: '#/components/schemas/PartType'
          description: Type (FOLDER, DOCUMENT, etc.)
        parent_path_id:
          type: string
          format: uuid
          nullable: true
          title: Parent Path Id
          description: Parent PathPart ID
        metadata_obj_id:
          type: string
          format: uuid
          nullable: true
          title: Metadata Obj Id
          description: ID of the underlying object
        materialized_path:
          type: string
          title: Materialized Path
          description: Full materialized path from root
        system_managed:
          type: boolean
          title: System Managed
          description: Whether this path part is system-managed
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last update timestamp
      additionalProperties: false
      type: object
      required:
        - path_part_id
        - name
        - part_type
        - parent_path_id
        - metadata_obj_id
        - materialized_path
        - system_managed
        - created_at
        - updated_at
      title: PathPartAncestorItem
      description: Single ancestor item in an ancestry chain.
    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
    PartType:
      type: string
      enum:
        - FOLDER
        - DOCUMENT
        - DOCUMENT_VERSION
        - SECTION
        - CHUNK
        - THREAD
        - THREAD_MESSAGE
        - WORKFLOW_DEFINITION
        - WORKFLOW_RUN
      title: PartType
      description: Type of path part in the filesystem.

````