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

# Create or update directory tree

> Create or update multiple files within a directory tree structure



## OpenAPI

````yaml https://raw.githubusercontent.com/blaxel-ai/sandbox/refs/heads/main/sandbox-api/docs/openapi.yml put /filesystem/tree/{path}
openapi: 3.0.0
info:
  contact: {}
  description: API for manipulating filesystem, processes and network.
  title: Sandbox API
  version: 0.0.1
servers:
  - url: https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run
    variables:
      sandbox_id:
        default: unknown
      workspace_id:
        default: unknown
      region:
        default: unknown
security:
  - BearerAuth: []
paths:
  /filesystem/tree/{path}:
    put:
      tags:
        - filesystem
      summary: Create or update directory tree
      description: Create or update multiple files within a directory tree structure
      parameters:
        - description: Root directory path
          in: path
          name: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TreeRequest'
        description: Map of file paths to content
        required: true
      responses:
        '200':
          description: Updated directory tree
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Directory'
                  - $ref: '#/components/schemas/FileWithContent'
                  - type: string
                    format: binary
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    TreeRequest:
      properties:
        files:
          additionalProperties:
            type: string
          example:
            '"dir/file2.txt"': '"content2"}'
            '{"file1.txt"': '"content1"'
          type: object
      type: object
    Directory:
      properties:
        files:
          items:
            $ref: '#/components/schemas/File'
          type: array
        name:
          type: string
        path:
          type: string
        subdirectories:
          description: '@name Subdirectories'
          items:
            $ref: '#/components/schemas/Subdirectory'
          type: array
      required:
        - files
        - name
        - path
        - subdirectories
      type: object
    FileWithContent:
      properties:
        content:
          type: string
        group:
          type: string
        lastModified:
          type: string
        name:
          type: string
        owner:
          type: string
        path:
          type: string
        permissions:
          type: string
        size:
          type: integer
      required:
        - content
        - group
        - lastModified
        - name
        - owner
        - path
        - permissions
        - size
      type: object
    ErrorResponse:
      properties:
        error:
          example: Error message
          type: string
      required:
        - error
      type: object
    File:
      properties:
        group:
          type: string
        lastModified:
          type: string
        name:
          type: string
        owner:
          type: string
        path:
          type: string
        permissions:
          type: string
        size:
          type: integer
      required:
        - group
        - lastModified
        - name
        - owner
        - path
        - permissions
        - size
      type: object
    Subdirectory:
      properties:
        name:
          type: string
        path:
          type: string
      required:
        - name
        - path
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````