curl --request POST \
--url https://api.cool.computer/api/computers/{id}/vm \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cool.computer/api/computers/{id}/vm"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cool.computer/api/computers/{id}/vm', 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}/vm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cool.computer/api/computers/{id}/vm"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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}/vm")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cool.computer/api/computers/{id}/vm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"computer": {
"id": "<string>",
"hostname": "<string>",
"name": "<string>",
"ip": "<string>",
"status": "<string>",
"visibility": "private",
"access": "owner",
"site": true,
"network_policy": {
"mode": "open",
"allowed_hosts": [
"api.example.com"
]
},
"created_at": "2023-11-07T05:31:56Z",
"url": "<string>",
"email_address": "jsmith@example.com",
"auto_delete_at": "2023-11-07T05:31:56Z",
"creation_mode": "<string>"
},
"changed": true
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}Give a site its own VM
Gives a site its own VM, an always-on Ubuntu machine with sudo, and waits until it runs and serves the site. This cannot be undone: the VM uses 1 of the account’s 20 VMs and memory from the account’s 8 GiB, which all its VMs share, the published files move to /home/runtime/app and keep serving at the computer’s URL, and publishing to it stops (409 computer_has_vm); change its files with the files API or exec instead. Repeating it is safe: a computer that already has its VM answers changed false, and if an earlier attempt left its link on the published site, repeating it also finishes moving the link (502 artifact_deploy_failed while that still fails). Exec, terminals, the port proxy and exposure need a VM and never give one. Only the computer’s own account may give it one: someone it is shared with gets 403 owner_required. It takes no Idempotency-Key: repeating it is safe, and a retry after a lost answer reports changed false while the computer has its VM.
curl --request POST \
--url https://api.cool.computer/api/computers/{id}/vm \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cool.computer/api/computers/{id}/vm"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cool.computer/api/computers/{id}/vm', 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}/vm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cool.computer/api/computers/{id}/vm"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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}/vm")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cool.computer/api/computers/{id}/vm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"computer": {
"id": "<string>",
"hostname": "<string>",
"name": "<string>",
"ip": "<string>",
"status": "<string>",
"visibility": "private",
"access": "owner",
"site": true,
"network_policy": {
"mode": "open",
"allowed_hosts": [
"api.example.com"
]
},
"created_at": "2023-11-07T05:31:56Z",
"url": "<string>",
"email_address": "jsmith@example.com",
"auto_delete_at": "2023-11-07T05:31:56Z",
"creation_mode": "<string>"
},
"changed": true
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"context": {},
"suggestions": [
"<string>"
]
}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
The computer's name, such as agent-atlas, or its id (cmp_…). Every caller may use either, the computer's own runtime token included.
1"agent-atlas"

