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

# Write a file into a running computer.



## OpenAPI

````yaml /api-reference/openapi.json put /api/v2/computers/{computer_id}/files
openapi: 3.1.0
info:
  title: Vers API
  description: >-
    REST API for creating, checkpointing, branching, and managing Vers computers
    and projects.
  version: 2.0.0
servers:
  - url: https://api.vers.sh
    description: Vers API
security:
  - bearerAuth: []
tags:
  - name: Computers
    description: Create, inspect, execute commands in, sleep, wake, and delete computers.
  - name: Branches
    description: Branch one or more computers from a live computer, checkpoint, or tag.
  - name: Checkpoints
    description: Capture, inspect, tag, and delete whole-computer checkpoints.
  - name: Projects
    description: >-
      Organize computers into projects with private service networks and grouped
      restores.
  - name: Operations
    description: Inspect and stream status events for asynchronous durable operations.
  - name: Images
    description: >-
      Import and manage custom OCI images, system images, and registry
      artifacts.
  - name: Repositories
    description: Manage checkpoint repositories, tags, and public catalog entries.
  - name: Domains
    description: Register and manage custom domains.
  - name: Environment Variables
    description: Manage account-level environment variables applied to new computers.
  - name: Account & System
    description: Inspect API key identity, usage, and control-plane health.
paths:
  /api/v2/computers/{computer_id}/files:
    put:
      tags:
        - Computers
      summary: Write a file into a running computer.
      operationId: write_computer_file
      parameters:
        - name: computer_id
          in: path
          description: Computer identity
          required: true
          schema:
            type: string
            format: uuid
        - name: path
          in: query
          description: Destination path on the computer; required for the binary contract.
          required: false
          schema:
            type: string
        - name: mode
          in: query
          description: File mode (e.g. 0644). Defaults to 0644 if omitted.
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
        - name: create_dirs
          in: query
          description: Create parent directories if they don't exist.
          required: false
          schema:
            type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VmWriteFileJsonRequest'
          application/octet-stream:
            schema:
              $ref: '#/components/schemas/VmWriteFileBody'
        required: true
      responses:
        '204':
          description: File written
        '400':
          description: Malformed file-write contract
        '401':
          description: Missing or invalid API key
        '404':
          description: Computer not found
        '409':
          description: Computer is sleeping
        '413':
          description: File body exceeds 16 MiB
        '415':
          description: Missing or unsupported Content-Type
        '422':
          description: The path cannot be written
components:
  schemas:
    VmWriteFileJsonRequest:
      type: object
      description: Request body for the JSON/base64 file-write contract.
      required:
        - path
        - content_b64
      properties:
        content_b64:
          type: string
          description: Base64-encoded file contents.
        create_dirs:
          type: boolean
          description: Create parent directories if they don't exist.
        mode:
          type: integer
          format: int32
          description: File mode (e.g. 0644). Defaults to 0644 if omitted.
          minimum: 0
        path:
          type: string
          description: Destination path on the VM.
    VmWriteFileBody:
      type: string
      format: binary
      description: Schema-only representation of the raw application/octet-stream body.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 'Vers API key (`VERS_API_KEY`) sent as `Authorization: Bearer <key>`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.