> ## Documentation Index
> Fetch the complete documentation index at: https://sourcebot-whoisthey-language-model-input-modalities.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a file tree

> Returns the file tree for a repository at a given revision.



## OpenAPI

````yaml /api-reference/sourcebot-public.openapi.json post /api/tree
openapi: 3.0.3
info:
  title: Sourcebot Public API
  version: v5.0.4
  description: >-
    OpenAPI description for the public Sourcebot REST endpoints used for search,
    repository listing, and file browsing. Authentication is instance-dependent:
    API keys are the standard integration mechanism, OAuth bearer tokens are
    EE-only, and some instances may allow anonymous access.
servers: []
security:
  - bearerToken: []
  - apiKeyHeader: []
  - {}
tags:
  - name: Search & Navigation
    description: Code search and symbol navigation endpoints.
  - name: Repositories
    description: Repository listing and metadata endpoints.
  - name: Git
    description: Git history, diff, and file content endpoints.
  - name: System
    description: System health and version endpoints.
  - name: Enterprise (EE)
    description: Enterprise endpoints for user management and audit logging.
paths:
  /api/tree:
    post:
      tags:
        - Git
      summary: Get a file tree
      description: Returns the file tree for a repository at a given revision.
      operationId: getFileTree
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicGetTreeRequest'
      responses:
        '200':
          description: File tree for the requested repository revision.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tree:
                    $ref: '#/components/schemas/PublicFileTreeNode'
                required:
                  - tree
                additionalProperties: false
        '400':
          description: Invalid request body or git ref.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiServiceError'
        '404':
          description: Repository or path not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiServiceError'
        '500':
          description: Unexpected tree retrieval failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiServiceError'
components:
  schemas:
    PublicGetTreeRequest:
      type: object
      properties:
        repoName:
          type: string
        revisionName:
          type: string
        paths:
          type: array
          items:
            type: string
      required:
        - repoName
        - revisionName
        - paths
    PublicFileTreeNode:
      type: object
      properties:
        type:
          type: string
        path:
          type: string
        name:
          type: string
        children:
          type: array
          items:
            $ref: '#/components/schemas/PublicFileTreeNode'
      required:
        - type
        - path
        - name
        - children
      additionalProperties: false
    PublicApiServiceError:
      type: object
      properties:
        statusCode:
          type: number
        errorCode:
          type: string
        message:
          type: string
      required:
        - statusCode
        - errorCode
        - message
      description: Structured error response returned by Sourcebot public API endpoints.
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your API key.
    apiKeyHeader:
      type: apiKey
      in: header
      name: X-Sourcebot-Api-Key
      description: >-
        Header of the form `X-Sourcebot-Api-Key: <token>`, where `<token>` is
        your API key.

````