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

# List a folder of a snapshot

> Returns the saved files and folders in one folder of a snapshot. A snapshot holds the saved files: the files and folders that are different from the base image. It works with no running sandbox, also after the sandbox is deleted, until its saved files are deleted. Needs the `snapshots:read` scope.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/snapshots/{id}/tree
openapi: 3.1.0
info:
  title: VMS API
  version: 1.0.0
  description: >-
    The public API of a VMS workspace. Each request needs an API key of the
    workspace in the Authorization header.
servers:
  - url: https://vms.dev/api
    description: The VMS API
security:
  - apiKey: []
paths:
  /v1/snapshots/{id}/tree:
    get:
      tags:
        - Snapshots
      summary: List a folder of a snapshot
      description: >-
        Returns the saved files and folders in one folder of a snapshot. A
        snapshot holds the saved files: the files and folders that are different
        from the base image. It works with no running sandbox, also after the
        sandbox is deleted, until its saved files are deleted. Needs the
        `snapshots:read` scope.
      operationId: getSnapshotTree
      parameters:
        - in: path
          name: id
          schema:
            type: string
            description: The ID of the snapshot.
            example: snp_06d8k3m7q2v9x4b1n5c0e8f2ja
          required: true
          description: The ID of the snapshot.
        - in: query
          name: path
          schema:
            $ref: '#/components/schemas/AbsolutePath'
            default: /
            description: The absolute path of a folder. The default is /.
            example: /home/user
          description: The absolute path of a folder. The default is /.
      responses:
        '200':
          description: The content of the folder.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnapshotTree'
        '400':
          description: The request is not valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The API key is missing, not correct, revoked, or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The API key does not have the scope of the endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            The workspace has no snapshot with this ID, or the snapshot has no
            saved file or folder at this path.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The path is a file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The API key sent more than 1,200 requests in one minute, or too many
            snapshot reads are open. Wait `retryAfterSeconds`, then try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Could not read the snapshot.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AbsolutePath:
      type: string
      minLength: 1
      maxLength: 4096
      pattern: ^\/
    SnapshotTree:
      type: object
      properties:
        snapshotId:
          type: string
        sandboxId:
          type: string
        path:
          $ref: '#/components/schemas/AbsolutePath'
        entries:
          type: array
          items:
            $ref: '#/components/schemas/SnapshotTreeEntry'
          description: The saved files and folders in the folder, sorted by name.
      required:
        - snapshotId
        - sandboxId
        - path
        - entries
      additionalProperties: false
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: no_capacity
            message:
              type: string
            requestId:
              type:
                - string
                - 'null'
            retryAfterSeconds:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            sandboxId:
              description: The sandbox that the error is about.
              type: string
          required:
            - code
            - message
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
    SnapshotTreeEntry:
      type: object
      properties:
        name:
          type: string
        path:
          $ref: '#/components/schemas/AbsolutePath'
        type:
          type: string
          enum:
            - file
            - directory
            - symlink
            - fifo
            - char
            - block
        size:
          anyOf:
            - type: integer
              minimum: 0
              maximum: 9007199254740991
            - type: 'null'
          description: The size of a file in bytes. null for other types.
        mode:
          anyOf:
            - $ref: '#/components/schemas/FileMode'
            - type: 'null'
          description: >-
            null for a folder that the snapshot shows only because it holds
            saved files.
        uid:
          anyOf:
            - type: integer
              minimum: 0
              maximum: 9007199254740991
            - type: 'null'
        gid:
          anyOf:
            - type: integer
              minimum: 0
              maximum: 9007199254740991
            - type: 'null'
        target:
          description: The target of a symbolic link. null for other types.
          type:
            - string
            - 'null'
        modifiedAt:
          anyOf:
            - type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
            - type: 'null'
      required:
        - name
        - path
        - type
        - size
        - mode
        - uid
        - gid
        - target
        - modifiedAt
      additionalProperties: false
    FileMode:
      type: string
      pattern: ^0[0-7]{3,4}$
      description: An octal mode, such as 0644.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: An API key that starts with vms_. Make one in Settings > API keys.

````

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