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

# Upload a tar

> Extracts a tar or a gzip tar into a folder. Creates the folder if it does not exist, and replaces the files that the tar contains. Send the content type `application/x-tar` or `application/gzip`. The body can be up to 128 MiB. A larger body gets `413`. Needs the `sandboxes:files` scope.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sandboxes/{id}/files/tar
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/sandboxes/{id}/files/tar:
    post:
      tags:
        - Files
      summary: Upload a tar
      description: >-
        Extracts a tar or a gzip tar into a folder. Creates the folder if it
        does not exist, and replaces the files that the tar contains. Send the
        content type `application/x-tar` or `application/gzip`. The body can be
        up to 128 MiB. A larger body gets `413`. Needs the `sandboxes:files`
        scope.
      operationId: uploadTar
      parameters:
        - in: path
          name: id
          schema:
            type: string
            example: sbx_06d8k3m7q2v9x4b1n5c0e8f2ja
          required: true
        - in: query
          name: path
          schema:
            $ref: '#/components/schemas/AbsolutePath'
            description: >-
              The absolute path of the folder for the content of the tar. If the
              folder does not exist, it is created.
            example: /home/user/project
          required: true
          description: >-
            The absolute path of the folder for the content of the tar. If the
            folder does not exist, it is created.
      requestBody:
        content:
          application/x-tar:
            schema:
              type: string
              format: binary
          application/gzip:
            schema:
              type: string
              format: binary
      responses:
        '200':
          description: The tar is extracted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxTarUpload'
        '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 sandbox with this ID, or no file or folder has
            this path.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The path is a folder, a folder in the path is a file, or the sandbox
            is not running (`sandbox_not_running`), is starting
            (`sandbox_starting`), or is stopping (`sandbox_stopping`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: The API key sent more than 1,200 requests in one minute.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Could not connect to the sandbox.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AbsolutePath:
      type: string
      minLength: 1
      maxLength: 4096
      pattern: ^\/
    SandboxTarUpload:
      type: object
      properties:
        sandboxId:
          type: string
        path:
          $ref: '#/components/schemas/AbsolutePath'
        entries:
          type: integer
          minimum: 0
          maximum: 9007199254740991
          description: The number of files and folders in the tar.
        bytes:
          type: integer
          minimum: 0
          maximum: 9007199254740991
          description: The size of the uploaded tar.
      required:
        - sandboxId
        - path
        - entries
        - bytes
      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
  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.