Autosave document files in one release
curl --request POST \
--url https://api.cool.computer/api/computers/{id}/files/document \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'id=<string>' \
--form 'base=<string>' \
--form additionalProperties=@example-fileimport requests
url = "https://api.cool.computer/api/computers/{id}/files/document"
files = { "additionalProperties": ("example-file", open("example-file", "rb")) }
payload = {
"id": "<string>",
"base": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('id', '<string>');
form.append('base', '<string>');
form.append('additionalProperties', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.cool.computer/api/computers/{id}/files/document', 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}/files/document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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}/files/document"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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}/files/document")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cool.computer/api/computers/{id}/files/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"version": "<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>"
]
}Files
Autosave document files in one release
Saves a document artifact's edited files as one release: the document bridge's save (backend/docs/sites/comments.md#document-autosave). Only a person who owns the computer or is an active share member saves, signed in through a browser session, user API key or person-bound access token; organization API keys answer 403 document_person_required, and computer tokens 401, since the route takes account credentials only. Field id is a save id of 1 to 128 bytes, kept per computer for 24 hours (the newest 32): a retry by the same person with the same id, base, paths and bytes returns that save's version, even after its release was coalesced away. Field base is the version the edits were made on. Every other part is one changed file, its field name the site-relative path encoded with encodeURIComponent (the filename is ignored). A docx, xlsx, pptx or pdf document saves only artifact.json's declared file; slides save deck/deck.json, deck/slides/<id>.html (id of 1 to 64 ASCII letters, digits, underscores or hyphens) and png, jpg, jpeg, gif, webp or svg files under deck/. Each file is at most 25 MiB, the changed files together at most 64 MiB. A base that is no longer live answers 409 document_conflict with the live version in context.version and writes nothing. Too many saves of the account at once, another save of the computer still publishing, or a publish holding the computer past the save's wait answer 429 document_save_busy with Retry-After: retry with the same id. Once the body is read, the save finishes within two minutes even if the client disconnects. Browser sessions need the same-origin Origin header. Comments may be off. Once the site has a VM, new saves answer 409 computer_has_vm.
POST
/
api
/
computers
/
{id}
/
files
/
document
Autosave document files in one release
curl --request POST \
--url https://api.cool.computer/api/computers/{id}/files/document \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'id=<string>' \
--form 'base=<string>' \
--form additionalProperties=@example-fileimport requests
url = "https://api.cool.computer/api/computers/{id}/files/document"
files = { "additionalProperties": ("example-file", open("example-file", "rb")) }
payload = {
"id": "<string>",
"base": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('id', '<string>');
form.append('base', '<string>');
form.append('additionalProperties', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.cool.computer/api/computers/{id}/files/document', 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}/files/document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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}/files/document"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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}/files/document")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cool.computer/api/computers/{id}/files/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"base\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"additionalProperties\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"version": "<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.
Minimum string length:
1Example:
"agent-atlas"
Body
multipart/form-data
Response
Saved live release version.

