Computer Actions
Execute bash
Run a bash command on the computer and get its output.
POST
/
computers
/
{id}
/
bash
Execute bash
curl --request POST \
--url https://www.orgo.ai/api/computers/{id}/bash \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "ls -la /home/user"
}
'import requests
url = "https://www.orgo.ai/api/computers/{id}/bash"
payload = { "command": "ls -la /home/user" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: 'ls -la /home/user'})
};
fetch('https://www.orgo.ai/api/computers/{id}/bash', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.orgo.ai/api/computers/{id}/bash",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'command' => 'ls -la /home/user'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.orgo.ai/api/computers/{id}/bash"
payload := strings.NewReader("{\n \"command\": \"ls -la /home/user\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.orgo.ai/api/computers/{id}/bash")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"ls -la /home/user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/computers/{id}/bash")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"ls -la /home/user\"\n}"
response = http.request(request)
puts response.read_body{
"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",
"success": true
}{
"error": "Invalid API key"
}{
"error": "Resource not found"
}Executes a bash command on the computer and returns the combined stdout/stderr output.
Path parameters
string
required
Computer ID (UUID).
Body parameters
string
required
Bash command to execute.
integer
default:"200"
Maximum execution time in seconds before the command is killed.
Response
string
Combined stdout and stderr.
integer
Process exit code.
string
Echo of the command that was executed.
boolean
true if the command ran (regardless of exit code). Check exit_code to determine if the command itself succeeded.Example
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"}'
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']}")
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}`);
Response
{
"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
}
For Python code execution, use Execute Python instead.
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). |
Authorizations
API key authentication. Get your key at orgo.ai/workspaces
Path Parameters
Computer ID
Body
application/json
Bash command to execute
⌘I
Execute bash
curl --request POST \
--url https://www.orgo.ai/api/computers/{id}/bash \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "ls -la /home/user"
}
'import requests
url = "https://www.orgo.ai/api/computers/{id}/bash"
payload = { "command": "ls -la /home/user" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: 'ls -la /home/user'})
};
fetch('https://www.orgo.ai/api/computers/{id}/bash', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.orgo.ai/api/computers/{id}/bash",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'command' => 'ls -la /home/user'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.orgo.ai/api/computers/{id}/bash"
payload := strings.NewReader("{\n \"command\": \"ls -la /home/user\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.orgo.ai/api/computers/{id}/bash")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"ls -la /home/user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/computers/{id}/bash")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"ls -la /home/user\"\n}"
response = http.request(request)
puts response.read_body{
"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",
"success": true
}{
"error": "Invalid API key"
}{
"error": "Resource not found"
}