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

# Execute bash

> Run a bash command on the computer and get its output.

Executes a bash command on the computer and returns the combined stdout/stderr output.

## Path parameters

<ParamField path="id" type="string" required>
  Computer ID (UUID).
</ParamField>

## Body parameters

<ParamField body="command" type="string" required>
  Bash command to execute.
</ParamField>

<ParamField body="timeout" type="integer" default="200">
  Maximum execution time in seconds before the command is killed.
</ParamField>

## Response

<ResponseField name="output" type="string">
  Combined stdout and stderr.
</ResponseField>

<ResponseField name="exit_code" type="integer">
  Process exit code.
</ResponseField>

<ResponseField name="command" type="string">
  Echo of the command that was executed.
</ResponseField>

<ResponseField name="success" type="boolean">
  `true` if the command ran (regardless of exit code). Check `exit_code` to determine if the command itself succeeded.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://www.orgo.ai/api/computers/a3bb189e-8bf9-3888-9912-ace4e6543002/bash \
    -H "Authorization: Bearer $ORGO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"command": "ls -la /home/user"}'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      f"https://www.orgo.ai/api/computers/{computer_id}/bash",
      headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
      json={"command": "ls -la /home/user"}
  )

  result = response.json()
  print(result["output"])
  print(f"Exit code: {result['exit_code']}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(`https://www.orgo.ai/api/computers/${computerId}/bash`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ command: 'ls -la /home/user' })
  });

  const { output, exit_code } = await response.json();
  console.log(output);
  console.log(`Exit code: ${exit_code}`);
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "action": "bash",
  "command": "ls -la /home/user",
  "output": "total 32\ndrwxr-xr-x 4 user user 4096 Jan 15 10:30 .\ndrwxr-xr-x 3 root root 4096 Jan 15 10:00 ..\n-rw-r--r-- 1 user user  220 Jan 15 10:00 .bashrc\ndrwxr-xr-x 2 user user 4096 Jan 15 10:30 Desktop\n",
  "exit_code": 0
}
```

<Tip>
  For Python code execution, use [Execute Python](/api-reference/computers/exec) instead.
</Tip>

## Errors

| Status | Meaning                                                               |
| ------ | --------------------------------------------------------------------- |
| `400`  | Computer instance not available.                                      |
| `401`  | Missing or invalid API key.                                           |
| `403`  | You do not have access to this computer.                              |
| `404`  | Computer not found.                                                   |
| `500`  | Upstream desktop agent failure (process spawn error, timeout killed). |


## OpenAPI

````yaml POST /computers/{id}/bash
openapi: 3.1.0
info:
  title: Orgo API
  description: >-
    Launch cloud computers that AI agents can control and interact with. Create
    workspaces, provision computers, and control them programmatically.
  version: 2.0.0
  contact:
    name: Orgo Support
    email: spencer@orgo.ai
    url: https://orgo.ai
servers:
  - url: https://www.orgo.ai/api
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: Organize computers into named workspaces
  - name: Computers
    description: Provision and manage virtual computers
  - name: Computer Lifecycle
    description: Start, stop, and restart computers
  - name: Computer Actions
    description: Control mouse, keyboard, and execute commands
  - name: Streaming
    description: Stream computer display via RTMP
  - name: Files
    description: Upload and download files
  - name: Templates
    description: Author, build, and launch reproducible computers from templates
paths:
  /computers/{id}/bash:
    post:
      tags:
        - Computer Actions
      summary: Execute bash
      description: Executes a bash command on the computer.
      operationId: executeBash
      parameters:
        - name: id
          in: path
          required: true
          description: Computer ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BashRequest'
            example:
              command: ls -la /home/user
      responses:
        '200':
          description: Command executed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BashResponse'
              example:
                output: |
                  total 32
                  drwxr-xr-x 4 user user 4096 Jan 15 10:30 .
                  drwxr-xr-x 3 root root 4096 Jan 15 10:00 ..
                  -rw-r--r-- 1 user user  220 Jan 15 10:00 .bashrc
                  drwxr-xr-x 2 user user 4096 Jan 15 10:30 Desktop
                success: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    BashRequest:
      type: object
      required:
        - command
      properties:
        command:
          type: string
          description: Bash command to execute
    BashResponse:
      type: object
      properties:
        output:
          type: string
          description: Command output
        success:
          type: boolean
          description: Whether command succeeded
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
  responses:
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid API key
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Resource not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication. Get your key at orgo.ai/workspaces

````