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

# Diff a tree against the previous tree

> Compute a diff between the given tree and the most recent completed tree
before it. Used by the knowledge manager to review what changed between
generations.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml get /context-documents/tree/{tree_id}/diff
openapi: 3.1.0
info:
  title: Hyperspell API
  summary: >-
    Hyperspell is the memory layer for AI apps and agents. Through the API, you
    can add memories, connect data sources to index them in real-time, and
    search memories with our natural language query engine.
  termsOfService: https://hyperspell.com/blog/tos
  contact:
    name: Hyperspell
    url: https://hyperspell.com/
    email: hello@hyperspell.com
  version: 0.32.1
servers:
  - url: https://api.hyperspell.com
    description: Production
security:
  - APIKey: []
    AsUser: []
paths:
  /context-documents/tree/{tree_id}/diff:
    get:
      tags:
        - Context Documents
      summary: Diff a tree against the previous tree
      description: |-
        Compute a diff between the given tree and the most recent completed tree
        before it. Used by the knowledge manager to review what changed between
        generations.
      operationId: get_tree_diff_context_documents_tree__tree_id__diff_get
      parameters:
        - name: tree_id
          in: path
          required: true
          schema:
            type: string
            title: Tree Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiffResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKey: []
        - AsUser: []
components:
  schemas:
    DiffResponse:
      properties:
        tree_id:
          type: string
          title: Tree Id
        previous_tree_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Previous Tree Id
        files_added:
          type: integer
          title: Files Added
        files_removed:
          type: integer
          title: Files Removed
        files_changed:
          type: integer
          title: Files Changed
        files_unchanged:
          type: integer
          title: Files Unchanged
        diffs:
          items:
            $ref: '#/components/schemas/FileDiff'
          type: array
          title: Diffs
      type: object
      required:
        - tree_id
        - previous_tree_id
        - files_added
        - files_removed
        - files_changed
        - files_unchanged
        - diffs
      title: DiffResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FileDiff:
      properties:
        path:
          type: string
          title: Path
        status:
          type: string
          title: Status
        old_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Old Content
      type: object
      required:
        - path
        - status
      title: FileDiff
    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
  securitySchemes:
    APIKey:
      type: http
      description: >-
        API Key or JWT User Token. If using an API Key, set the X-As-User header
        to act as a specific user. A JWT User Token is always scoped to a
        specific user.
      scheme: bearer
      bearerFormat: Bearer <token>
    AsUser:
      type: apiKey
      description: >-
        Optionally set this header to act as a specific user when using an API
        Key, equivalent to first exchanging the API Key for a User Token
      in: header
      name: X-As-User

````