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

# A folder in a repo

> Its entries at a branch, tag or commit: folders first, then by name, with no sizes. At most 5,000, and `truncated` says when there are more. 404 `ref_not_found`, `path_not_found` or `not_a_folder`.



## OpenAPI

````yaml /api-reference/openapi.json get /projects/{owner}/{slug}/repo/tree
openapi: 3.1.0
info:
  title: Patch API
  version: 1.0.0
  description: >-
    The public API behind patch.gg, the desktop app and pch. Changes within v1
    are additive only. Errors are { error: { code, message, details } }; branch
    on code.
servers:
  - url: https://patch.gg/api/v1
security: []
paths:
  /projects/{owner}/{slug}/repo/tree:
    get:
      tags:
        - Repos
      summary: A folder in a repo
      description: >-
        Its entries at a branch, tag or commit: folders first, then by name,
        with no sizes. At most 5,000, and `truncated` says when there are more.
        404 `ref_not_found`, `path_not_found` or `not_a_folder`.
      parameters:
        - schema:
            type: string
            example: patch
          required: true
          name: owner
          in: path
        - schema:
            type: string
            example: demo-mod
          required: true
          name: slug
          in: path
        - schema:
            type: string
            pattern: ^\S{1,255}$
            description: >-
              A branch, a tag or a full commit hash: the default branch unless
              you say. A branch comes before a tag of the same name, and
              `refs/tags/v1` says which.
            example: main
          required: false
          description: >-
            A branch, a tag or a full commit hash: the default branch unless you
            say. A branch comes before a tag of the same name, and
            `refs/tags/v1` says which.
          name: ref
          in: query
        - schema:
            type: string
            maxLength: 4096
            default: ''
            description: A folder in the repo, from its top
            example: docs/images
          required: false
          description: A folder in the repo, from its top
          name: path
          in: query
      responses:
        '200':
          description: The folder
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepoTree'
        '308':
          description: Renamed; follow the Location header
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not signed in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '`on_github`: its home is GitHub, which has its files'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Too many requests: wait as long as `Retry-After` says
            (`retry_after_s` in `details`), then retry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: It couldn't be read
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Reading repos isn't set up here, or the repo is waking up
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    RepoTree:
      type: object
      properties:
        ref:
          type: string
          description: >-
            The branch, tag or full commit hash it was asked for: the default
            branch unless given.
        commit:
          type: string
          description: The full commit hash that resolved to.
        path:
          type: string
          description: The folder, empty at the top of the repo.
        entries:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: >-
                  Bytes that aren't UTF-8 show as U+FFFD, and such a file can't
                  be read by this name.
              type:
                type: string
                enum:
                  - tree
                  - blob
                  - exec
                  - symlink
                  - gitlink
                description: >-
                  tree: a folder. blob: a file. exec: an executable file.
                  symlink: a link. gitlink: a submodule.
              mode:
                type: string
                example: '100644'
            required:
              - name
              - type
              - mode
          description: Folders first, then by name. They carry no sizes.
        truncated:
          type: boolean
          description: 'Whether any entries were left out: there are at most 5,000.'
      required:
        - ref
        - commit
        - path
        - entries
        - truncated
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: version_exists
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.