curl --request POST \
--url https://api.cool.computer/api/computers/{id}/exec/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"execution_id": "<string>",
"after_id": 1,
"cwd": "<string>",
"uid": 1,
"gid": 1,
"shell": "<string>",
"stdin_base64": "<string>",
"env": {}
}
'import requests
url = "https://api.cool.computer/api/computers/{id}/exec/stream"
payload = {
"command": "<string>",
"execution_id": "<string>",
"after_id": 1,
"cwd": "<string>",
"uid": 1,
"gid": 1,
"shell": "<string>",
"stdin_base64": "<string>",
"env": {}
}
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: '<string>',
execution_id: '<string>',
after_id: 1,
cwd: '<string>',
uid: 1,
gid: 1,
shell: '<string>',
stdin_base64: '<string>',
env: {}
})
};
fetch('https://api.cool.computer/api/computers/{id}/exec/stream', 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://api.cool.computer/api/computers/{id}/exec/stream",
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' => '<string>',
'execution_id' => '<string>',
'after_id' => 1,
'cwd' => '<string>',
'uid' => 1,
'gid' => 1,
'shell' => '<string>',
'stdin_base64' => '<string>',
'env' => [
]
]),
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://api.cool.computer/api/computers/{id}/exec/stream"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"execution_id\": \"<string>\",\n \"after_id\": 1,\n \"cwd\": \"<string>\",\n \"uid\": 1,\n \"gid\": 1,\n \"shell\": \"<string>\",\n \"stdin_base64\": \"<string>\",\n \"env\": {}\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://api.cool.computer/api/computers/{id}/exec/stream")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"execution_id\": \"<string>\",\n \"after_id\": 1,\n \"cwd\": \"<string>\",\n \"uid\": 1,\n \"gid\": 1,\n \"shell\": \"<string>\",\n \"stdin_base64\": \"<string>\",\n \"env\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cool.computer/api/computers/{id}/exec/stream")
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\": \"<string>\",\n \"execution_id\": \"<string>\",\n \"after_id\": 1,\n \"cwd\": \"<string>\",\n \"uid\": 1,\n \"gid\": 1,\n \"shell\": \"<string>\",\n \"stdin_base64\": \"<string>\",\n \"env\": {}\n}"
response = http.request(request)
puts response.read_body{
"type": "pid",
"status": "running",
"execution_id": "<string>",
"pid": 2,
"id": 2,
"timestamp": "2023-11-07T05:31:56Z",
"stdout": "<string>",
"stderr": "<string>",
"dropped_bytes": 1,
"dropped_frames": 1,
"exit_code": 123,
"signal": "<string>",
"code": "<string>",
"error": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}Run a command and stream its output
Runs one command and streams newline-delimited frames: stdout, stderr and drop frames, then one final exit or error frame. Every frame carries execution_id; omit it in the request and the server mints one, returned in the first frame, which attach and cancel accept. stdin_base64 is written to the command’s standard input. Callers: an account bearer of the owner or of someone the computer is shared with.
curl --request POST \
--url https://api.cool.computer/api/computers/{id}/exec/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"execution_id": "<string>",
"after_id": 1,
"cwd": "<string>",
"uid": 1,
"gid": 1,
"shell": "<string>",
"stdin_base64": "<string>",
"env": {}
}
'import requests
url = "https://api.cool.computer/api/computers/{id}/exec/stream"
payload = {
"command": "<string>",
"execution_id": "<string>",
"after_id": 1,
"cwd": "<string>",
"uid": 1,
"gid": 1,
"shell": "<string>",
"stdin_base64": "<string>",
"env": {}
}
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: '<string>',
execution_id: '<string>',
after_id: 1,
cwd: '<string>',
uid: 1,
gid: 1,
shell: '<string>',
stdin_base64: '<string>',
env: {}
})
};
fetch('https://api.cool.computer/api/computers/{id}/exec/stream', 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://api.cool.computer/api/computers/{id}/exec/stream",
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' => '<string>',
'execution_id' => '<string>',
'after_id' => 1,
'cwd' => '<string>',
'uid' => 1,
'gid' => 1,
'shell' => '<string>',
'stdin_base64' => '<string>',
'env' => [
]
]),
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://api.cool.computer/api/computers/{id}/exec/stream"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"execution_id\": \"<string>\",\n \"after_id\": 1,\n \"cwd\": \"<string>\",\n \"uid\": 1,\n \"gid\": 1,\n \"shell\": \"<string>\",\n \"stdin_base64\": \"<string>\",\n \"env\": {}\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://api.cool.computer/api/computers/{id}/exec/stream")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"execution_id\": \"<string>\",\n \"after_id\": 1,\n \"cwd\": \"<string>\",\n \"uid\": 1,\n \"gid\": 1,\n \"shell\": \"<string>\",\n \"stdin_base64\": \"<string>\",\n \"env\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cool.computer/api/computers/{id}/exec/stream")
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\": \"<string>\",\n \"execution_id\": \"<string>\",\n \"after_id\": 1,\n \"cwd\": \"<string>\",\n \"uid\": 1,\n \"gid\": 1,\n \"shell\": \"<string>\",\n \"stdin_base64\": \"<string>\",\n \"env\": {}\n}"
response = http.request(request)
puts response.read_body{
"type": "pid",
"status": "running",
"execution_id": "<string>",
"pid": 2,
"id": 2,
"timestamp": "2023-11-07T05:31:56Z",
"stdout": "<string>",
"stderr": "<string>",
"dropped_bytes": 1,
"dropped_frames": 1,
"exit_code": 123,
"signal": "<string>",
"code": "<string>",
"error": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {}
}Authorizations
A Cool Computers API key, user access token, or claimed agent access token in the Authorization header. Follow https://www.cool.computer/auth.md for agent registration and https://www.cool.computer/authentication.md for direct user credentials.
Path Parameters
Stable public computer identifier.
1"cmp_123"
Body
1Optional caller identity bound to the target computer. Omit it and the server mints one, returned in the first frame.
^cmp_[0-9a-f]{24}\.exec\.[0-9a-f]{32}$x >= 0Existing absolute directory without symlinks.
x >= 0x >= 0Standard input, base64-encoded.
Show child attributes
Show child attributes
Response
Newline-delimited output frames and one final result.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
pid, stdout, stderr, drop, exit, error "pid"running, succeeded, failed, cancelled, owner_lost "running"^cmp_[0-9a-f]{24}\.exec\.[0-9a-f]{32}$x >= 1Monotonic replay cursor present only on stdout, stderr, and drop frames.
x >= 1x >= 0x >= 0
