---
title: "Execute a bash command on the desktop"
method: POST
path: "/v1/desktop/{id}/bash-action"
tags: ["Desktop"]
---

# Execute a bash command on the desktop

`POST /v1/desktop/{id}/bash-action`

Runs a bash command on the desktop and returns the command output

## Path parameters

- `id` string, required — Desktop instance ID to run the command on

## Headers

- `x-api-key` string, required — API key for authentication

## Request body

- object
  - `command` string, required — Bash command to execute

## Response `200`

Command executed successfully. Response contains command output.

- object
  - `output` string — Raw string output from the executed command (if any)
  - `error` string — Error message if the operation failed (also indicated by non-2xx HTTP status)
  - `base64_image` string — Base64 encoded JPEG image data (only returned for screenshot actions)

## Other responses

- `400` — The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
- `401` — Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.
- `403` — The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server.
- `404` — The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web.
- `409` — This response is sent when a request conflicts with the current state of the server.
- `429` — The user has sent too many requests in a given amount of time ("rate limiting")
- `500` — The server has encountered a situation it does not know how to handle.
- `502` — The server, while acting as a gateway or proxy, received an invalid response from the upstream server.

---

[API](https://skmtc.net/cyberdesk-hq/apis/api-reference.md) · [All operations](https://skmtc.net/cyberdesk-hq/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cyberdesk-hq/api-reference/versions/586b758d6514/schema)
