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

# Process Stdin

> Write raw bytes to a process whose stdin was opened in `pipe` mode.

Write raw bytes to a process's stdin.

The process must be started with `stdin_mode: "pipe"` for this endpoint to work.

## Write to Stdin

```http theme={null}
POST /api/v1/processes/{pid}/stdin
```

```bash theme={null}
curl -X POST https://<sandbox-id>.sandbox.tensorlake.ai/api/v1/processes/42/stdin \
  -H "Authorization: Bearer $TENSORLAKE_API_KEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "print('hello')\n"
```

Tensorlake returns `204 No Content` when the bytes are accepted.

If stdin was not opened in `pipe` mode, Tensorlake returns `400 Bad Request`. Missing processes return `404 Not Found`.

To deliver EOF without killing the process, use [Close Process Stdin](/api-reference/v2/processes/close-stdin).


## OpenAPI

````yaml post /api/v1/processes/{pid}/stdin
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/processes/{pid}/stdin:
    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: pid
        in: path
        description: The operating system PID of the process.
        required: true
        schema:
          type: integer
          format: int32
    post:
      tags:
        - sandbox-processes
      summary: Write to stdin
      description: Write raw bytes to a process whose stdin was opened in `pipe` mode.
      operationId: sandbox_process_stdin
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '204':
          description: Stdin bytes accepted
        '400':
          description: Stdin is not writable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
        '404':
          description: Process not found
          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

````