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

# Write File

> Write raw bytes to a sandbox file path through the sandbox proxy.

Write bytes to a sandbox path.

## Endpoint

```http theme={null}
PUT /api/v1/files?path=<absolute-or-relative-path>
```

## Example Request

```bash theme={null}
curl -X PUT "https://<sandbox-id>.sandbox.tensorlake.ai/api/v1/files?path=/workspace/config.json" \
  -H "Authorization: Bearer $TENSORLAKE_API_KEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary '{"debug": true, "port": 8080}'
```

## Response

Tensorlake returns `204 No Content` when the write succeeds.

Parent directories are created automatically if needed. Paths containing `..` are rejected with `403 Forbidden`.


## OpenAPI

````yaml put /api/v1/files
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:
  /api/v1/files:
    servers:
      - url: https://{identifier}.sandbox.tensorlake.ai
        description: >-
          Example sandbox proxy host for a specific running sandbox. For
          programmatic access, use the sandbox's `ingress_endpoint`.
        variables:
          identifier:
            default: example-sandbox
            description: The sandbox ID or sandbox name.
    parameters:
      - name: path
        in: query
        description: Absolute or relative file path inside the sandbox.
        required: true
        schema:
          type: string
    put:
      tags:
        - sandbox-files
      summary: Write a file
      description: Write raw bytes to a sandbox file path through the sandbox proxy.
      operationId: sandbox_file_write
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '204':
          description: File written successfully
        '403':
          description: Path traversal rejected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
components:
  schemas:
    SandboxProxyError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````