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

# Execute a process and stream its stdout and stderr.

> Streams binary stdout/stderr without buffering the result. Waits for an
admitted checkpoint restore, bounded by the configured boot timeout.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v2/computers/{computer_id}/exec/stream
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}/exec/stream:
    post:
      tags:
        - Computers
      summary: Execute a process and stream its stdout and stderr.
      description: |-
        Streams binary stdout/stderr without buffering the result. Waits for an
        admitted checkpoint restore, bounded by the configured boot timeout.
      operationId: stream_computer
      parameters:
        - name: computer_id
          in: path
          description: Computer identity
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VmExecRequest'
        required: true
      responses:
        '200':
          description: NDJSON stdout/stderr chunks followed by a terminal exit event
          content:
            application/x-ndjson:
              schema:
                $ref: '#/components/schemas/VmExecStreamEvent'
        '401':
          description: Missing or invalid API key
        '404':
          description: Computer not found or not visible to the caller
        '409':
          description: Computer cannot currently execute a process
        '501':
          description: Process execution is unsupported
        '502':
          description: Computer process service is unavailable
        '503':
          description: Checkpoint restore wait timed out; no process was started
components:
  schemas:
    VmExecRequest:
      type: object
      description: |-
        Request body for `POST /api/v2/computers/{computer_id}/exec` and its
        streaming variant.
      required:
        - command
      properties:
        command:
          type: array
          items:
            type: string
          description: Command and arguments to execute.
        env:
          type:
            - object
            - 'null'
          description: Optional environment variables to set for the process.
          additionalProperties:
            type: string
          propertyNames:
            type: string
        exec_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Optional exec identifier for tracking.
        keep_background:
          type: boolean
          description: >-
            Keep processes the command leaves running (for example `server &`)

            after it exits, as `docker exec` does. By default they are killed
            when

            the command exits. The reply arrives once the command exits; output

            the kept processes write afterwards is retained in the exec logs.
        stdin:
          type:
            - string
            - 'null'
          description: Optional stdin payload passed to the command.
        timeout_secs:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Timeout in seconds. Omitted or zero uses 300 seconds; larger values
            are

            capped at 3600 seconds.
          minimum: 0
        working_dir:
          type:
            - string
            - 'null'
          description: Optional working directory for the command.
    VmExecStreamEvent:
      oneOf:
        - type: object
          required:
            - cursor
            - stream
            - data_b64
            - type
          properties:
            cursor:
              type: integer
              format: int64
              minimum: 0
            data_b64:
              type: string
            exec_id:
              type:
                - string
                - 'null'
              format: uuid
            stream:
              $ref: '#/components/schemas/VmExecLogStream'
            type:
              type: string
              enum:
                - chunk
        - type: object
          required:
            - cursor
            - exit_code
            - type
          properties:
            cursor:
              type: integer
              format: int64
              minimum: 0
            exec_id:
              type:
                - string
                - 'null'
              format: uuid
            exit_code:
              type: integer
              format: int32
            infrastructure_error:
              oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/VmExecStreamInfrastructureError'
            type:
              type: string
              enum:
                - exit
      description: >-
        Streaming exec events emitted over the exec stream endpoint (NDJSON
        lines).
    VmExecLogStream:
      type: string
      description: Streams available for exec logging.
      enum:
        - stdout
        - stderr
    VmExecStreamInfrastructureError:
      type: object
      description: >-
        Machine-readable infrastructure failure attached to a terminal exec
        event.
      required:
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
  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.