Skip to main content
POST
Run the computer's service

Authorizations

Authorization
string
header
required

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.

Headers

Idempotency-Key
string

A caller-generated key for safely retrying this side effect. The server retains the key and response for 24 hours. Reusing it with the same request replays the original response, except after a failure that proves nothing happened: that is kept for one minute, and one that sets Retry-After is not kept, so a retry after it runs the request again; reusing it with different input returns 409.

Required string length: 1 - 128
Pattern: ^[!-~]+$
Example:

"req_01J6M6Y9TF9Q9QF6M1ZP8K4R2A"

Path Parameters

id
string
required

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: 1
Example:

"agent-atlas"

Body

application/json
command
string
required

Shell line that starts the long-running program. It runs again on every restart, so install dependencies with a one-shot exec first.

Minimum string length: 1
cwd
string

Absolute path to an existing directory, reached without symlinks, used to start the program; anything else answers 400 invalid_cwd. Omit it to use /home/runtime/app (created if missing) with a port, and /home/runtime without one, so a worker's files stay out of the published folder; status reports it. / and /home are refused with 400. /home/runtime is allowed: every credential file in it is under a hidden path, which the computer's URL never serves.

port
integer

Port the program listens on; it is ready once the port accepts connections, and the computer's URL then reaches it. Omit it for a program that serves no port, such as a bot or a worker. Platform ports 3129, 18080 and 18088 are reserved.

Required range: 1 <= x <= 65535
secrets
string

Secret set (PUT /api/secrets/{secret_set}) whose keys the program gets as environment variables each time the service starts; a key delivered by proxy arrives as its stand-in. A changed set reaches the program at its next restart (POST .../service/restart).

Required string length: 1 - 63
env
object

Plain environment variables for the program; names are letters, digits and , not starting with RUNTIME. Keep keys and tokens in a secret set instead.

Response

The configured service and current process state.

configured
boolean
required
status
string
required

unconfigured; starting (the program runs but is not ready yet); running (ready); restarting (waiting to start the program again after a crash); stopped; exited (the program ended with code 0); failed; unknown or unavailable when the VM cannot say; or the computer's status while it is not running.

ready
boolean
required

With a port, the port accepts connections; without one, the program has stayed up 5 s.

restarts
integer
required

How often the program was started again after a crash since the service was last started.

Required range: x >= 0
url
string<uri>
command
string
cwd
string
port
integer

Absent for a program that serves no port.

Required range: 1 <= x <= 65535
exec_id
string
pid
integer
Required range: x >= 1
started_at
string<date-time>
ended_at
string<date-time>
exit_code
integer
signal
string
last_exit
object

The last crash it was restarted after.

last_output
string

The program's last line of output, while it is not ready.

logs
object