> ## 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.

# Download a file or a folder of a snapshot

> Returns the content of a file. For a folder, returns a tar of the folder and of each saved file and folder in it. 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}/files
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}/files:
    get:
      tags:
        - Snapshots
      summary: Download a file or a folder of a snapshot
      description: >-
        Returns the content of a file. For a folder, returns a tar of the folder
        and of each saved file and folder in it. 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: getSnapshotFile
      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'
            description: The absolute path of a file or a folder.
            example: /home/user/app/index.ts
          required: true
          description: The absolute path of a file or a folder.
      responses:
        '200':
          description: The content of the file, or a tar of the folder.
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
            application/x-tar:
              schema:
                type: string
                format: binary
        '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 link or a device. Or: The snapshot uses an old format
            (`snapshot_old_format`). Resume the sandbox to read its files.
          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: ^\/
    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
  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.