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

# Send stdin to a command

> Writes data to the stdin of a running command. The command must start with `stdin: true`. Send `eof: true` to close stdin. Needs the `sandboxes:exec` scope.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sandboxes/{id}/commands/{commandId}/stdin
openapi: 3.1.0
info:
  title: VMS API
  version: 1.0.0
  description: >-
    The public API of a VMS workspace. Each request needs an API key of the
    workspace in the Authorization header.
servers:
  - url: https://vms.dev/api
    description: The VMS API
security:
  - apiKey: []
paths:
  /v1/sandboxes/{id}/commands/{commandId}/stdin:
    post:
      tags:
        - Commands
      summary: Send stdin to a command
      description: >-
        Writes data to the stdin of a running command. The command must start
        with `stdin: true`. Send `eof: true` to close stdin. Needs the
        `sandboxes:exec` scope.
      operationId: sendCommandStdin
      parameters:
        - in: path
          name: id
          schema:
            type: string
            description: The ID of the sandbox.
          required: true
          description: The ID of the sandbox.
        - in: path
          name: commandId
          schema:
            type: string
            description: The ID of the command.
          required: true
          description: The ID of the command.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandStdinBody'
      responses:
        '204':
          description: The command got the data.
        '400':
          description: The request is not valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The API key is missing, not correct, revoked, or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The API key does not have the scope of the endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            The workspace has no sandbox with this ID, or the sandbox has no
            command with this ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The command exited, or the sandbox is not running, starting, or
            stopping.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: The API key sent more than 1,200 requests in one minute.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Could not connect to the sandbox.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CommandStdinBody:
      type: object
      properties:
        data:
          type: string
        encoding:
          $ref: '#/components/schemas/Encoding'
          description: The encoding of data. The default is utf8.
        eof:
          description: Close stdin after this data.
          type: boolean
      required:
        - data
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: no_capacity
            message:
              type: string
            requestId:
              type:
                - string
                - 'null'
            retryAfterSeconds:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            sandboxId:
              description: The sandbox that the error is about.
              type: string
          required:
            - code
            - message
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
    Encoding:
      type: string
      enum:
        - utf8
        - base64
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: An API key that starts with vms_. Make one in Settings > API keys.

````

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