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

# Attach Filesystem

> Attach a filesystem to a running sandbox at an absolute guest mount path. Returns `200 OK` once the mount is persisted; the mount applies asynchronously on the live sandbox. If the mount later cannot converge — including a `file_system_id` that does not exist — the sandbox is terminated fail-closed with `termination_reason` and `error_details` on the sandbox object, so verify the filesystem exists (for example with `tl fs ls`) before attaching.

Attach a [filesystem](/sandboxes/mount-filesystems) to a running sandbox at an absolute guest mount path.

* This path accepts either the sandbox ID or the sandbox name.
* `file_system_id` is the filesystem's name — the one created with `tl fs create <name>`.
* `200 OK` means the mount is persisted; it applies asynchronously on the live sandbox moments later.
* If the mount later cannot converge — including a filesystem that does not exist — the sandbox is terminated fail-closed with `termination_reason` and `error_details` on the sandbox object. Verify the filesystem exists (e.g. `tl fs ls`) before attaching.
* Tensorlake returns `400 Bad Request` when the sandbox runs on an executor fleet without filesystem support.
* Tensorlake returns `409 Conflict` when the sandbox is not running, the mount path is already in use, the sandbox is at the 8-mount cap, or the sandbox's executor is momentarily unresolvable. The last case is transient — retry shortly.


## OpenAPI

````yaml post /sandboxes/{sandbox_id}/file_systems
openapi: 3.1.0
info:
  title: Tensorlake API
  description: >-
    Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
    Workflows
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.tensorlake.ai/
security:
  - bearerAuth: []
tags:
  - name: Tensorlake Cloud API
    description: >-
      Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
      Workflows
paths:
  /sandboxes/{sandbox_id}/file_systems:
    parameters:
      - name: sandbox_id
        in: path
        description: The sandbox ID or sandbox name.
        required: true
        schema:
          type: string
    post:
      tags:
        - sandboxes
      summary: Attach a filesystem
      description: >-
        Attach a filesystem to a running sandbox at an absolute guest mount
        path. Returns `200 OK` once the mount is persisted; the mount applies
        asynchronously on the live sandbox. If the mount later cannot converge —
        including a `file_system_id` that does not exist — the sandbox is
        terminated fail-closed with `termination_reason` and `error_details` on
        the sandbox object, so verify the filesystem exists (for example with
        `tl fs ls`) before attaching.
      operationId: attach_file_system
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileSystemMount'
        required: true
      responses:
        '200':
          description: >-
            Filesystem attach accepted and persisted; the returned sandbox
            already reflects the new `file_systems` entry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxInfo'
        '400':
          description: >-
            Invalid mount, or the sandbox runs on an executor fleet without
            filesystem support
          content:
            text/plain: {}
        '401':
          description: Unauthorized. Invalid or missing credentials
        '403':
          description: Forbidden. You do not have permission to access this resource
        '404':
          description: Sandbox not found
          content:
            text/plain: {}
        '409':
          description: >-
            Sandbox not running, mount path already in use or at the mount cap,
            or the sandbox's executor is momentarily unresolvable (transient —
            retry shortly)
          content:
            text/plain: {}
        '500':
          description: Internal server error
          content:
            text/plain: {}
components:
  schemas:
    FileSystemMount:
      type: object
      required:
        - file_system_id
        - mount_path
      properties:
        file_system_id:
          type: string
          description: >-
            Filesystem name within the project — the name created with `tl fs
            create <name>`. ASCII letters, digits, `_`, and `-` only.
        mount_path:
          type: string
          description: >-
            Absolute guest mount path (e.g. `/mnt/skills`). Must not be `/` or
            contain `..`; paths are normalized, and mount paths must be unique
            and non-nested within the sandbox.
        read_only:
          type: boolean
          default: false
          description: >-
            Mount the filesystem read-only. Writes inside the guest fail with
            `EROFS`; the mount's storage credential carries no write scope.
            Fail-closed — sandboxes requesting read-only mounts are only placed
            on fleets that can enforce them.
        prefetch:
          type: boolean
          default: false
          description: >-
            Download the filesystem's full tree in the background after the
            mount is ready. The mount is usable immediately with lazy reads
            meanwhile. Best-effort — never blocks or fails the sandbox, and
            older fleets skip it silently.
    SandboxInfo:
      type: object
      required:
        - id
        - namespace
        - status
        - created_at
        - resources
        - timeout_secs
        - allow_unauthenticated_access
      properties:
        id:
          type: string
        namespace:
          type: string
        image:
          type: string
        status:
          $ref: '#/components/schemas/SandboxStatus'
        pending_reason:
          type:
            - string
            - 'null'
          description: Present when `status` is `pending`.
        outcome:
          type:
            - string
            - 'null'
          description: >-
            Platform-specific termination outcome string returned for completed
            sandboxes.
        termination_reason:
          type:
            - string
            - 'null'
          description: >-
            Typed reason the sandbox terminated (e.g. `FileSystemNotFound`,
            `ImageNotFound`). Present on failed terminations.
        error_details:
          type:
            - string
            - 'null'
          description: Human-readable detail accompanying `termination_reason`.
        created_at:
          type: integer
          format: int64
          description: Milliseconds since Unix epoch.
        container_id:
          type:
            - string
            - 'null'
        executor_id:
          type:
            - string
            - 'null'
        resources:
          $ref: '#/components/schemas/ContainerResourcesInfo'
        timeout_secs:
          type: integer
          format: int64
        ingress_endpoint:
          type:
            - string
            - 'null'
          description: Canonical server-provided base for sandbox-specific ingress.
        sandbox_url:
          type:
            - string
            - 'null'
          description: Sandbox-specific management URL derived from `ingress_endpoint`.
        pool_id:
          type:
            - string
            - 'null'
        network_policy:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SandboxNetworkAccessControl'
        allow_unauthenticated_access:
          type: boolean
          description: Whether sandbox ingress may route requests without auth validation.
        exposed_ports:
          type:
            - array
            - 'null'
          items:
            type: integer
            format: int32
            minimum: 1
            maximum: 65535
          description: >-
            Additional routable ingress ports. When `null`, only the management
            port `9501` is routable.
        template_id:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        file_systems:
          type: array
          description: Filesystems currently mounted into the sandbox.
          items:
            $ref: '#/components/schemas/FileSystemMount'
    SandboxStatus:
      type: string
      enum:
        - pending
        - running
        - snapshotting
        - suspending
        - suspended
        - terminated
    ContainerResourcesInfo:
      type: object
      required:
        - cpus
        - memory_mb
        - disk_mb
      properties:
        cpus:
          type: number
          format: double
          description: CPU allocation in cores.
        memory_mb:
          type: integer
          format: int64
          description: Memory allocation in MiB.
        disk_mb:
          type: integer
          format: int64
          description: Ephemeral root filesystem size in MiB.
    SandboxNetworkAccessControl:
      type: object
      properties:
        allow_internet_access:
          type: boolean
          default: true
          description: >-
            Allows internet access, including DNS requests. If false, all
            outbound traffic except destinations in allow_out is blocked,
            including DNS requests. If allow_out is non-empty and this is true,
            only the listed destinations and DNS requests are allowed.
        allow_out:
          type: array
          description: >-
            Allowed domains, IPv4 addresses, or IPv4 CIDRs. A non-empty list
            allows the listed destinations and DNS requests when
            allow_internet_access is true. Hostname rules are followed across
            DNS changes. A destination also matched by deny_out is blocked.
          items:
            type: string
        deny_out:
          type: array
          description: >-
            Denied domains, IPv4 addresses, or IPv4 CIDRs. Takes precedence over
            allow_out; a destination matched by both is blocked.
          items:
            type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````