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

# Post apiv1vm exec



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/vm/{vm_id}/exec
openapi: 3.1.0
info:
  title: Orchestrator Control Plane API
  description: ''
  license:
    name: ''
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/vm/{vm_id}/exec:
    post:
      tags:
        - vm
      operationId: exec_vm
      parameters:
        - name: vm_id
          in: path
          description: VM ID
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VmExecRequest'
        required: true
      responses:
        '200':
          description: Command executed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VmExecResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: VM not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    VmExecRequest:
      type: object
      description: Request body for POST /api/vm/{vm_id}/exec
      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.
        stdin:
          type:
            - string
            - 'null'
          description: Optional stdin payload passed to the command.
        timeout_secs:
          type:
            - integer
            - 'null'
          format: int64
          description: Timeout in seconds (0 = no timeout).
          minimum: 0
        working_dir:
          type:
            - string
            - 'null'
          description: Optional working directory for the command.
    VmExecResponse:
      type: object
      description: Response body for POST /api/vm/{vm_id}/exec
      required:
        - exit_code
        - stdout
        - stderr
      properties:
        exec_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Exec identifier associated with this run.
        exit_code:
          type: integer
          format: int32
          description: Exit code returned by the command.
        stderr:
          type: string
          description: UTF-8 decoded stderr (lossy).
        stdout:
          type: string
          description: UTF-8 decoded stdout (lossy).
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Reason of error
        success:
          type: boolean
          description: 'Is always: false'
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: Token

````