API(7)Miscellaneous Information ManualAPI(7)

api — scripts and CI over HTTPS

Where ssh is awkward, in CI runners for instance, the same commands run over HTTPS with a token. A token is an account key with limits: which commands, which VM, until when. Removing the key revokes the token. Tokens signed by a key added with --ci are refused; see ssh-key(1).

$ ssh chroot.dev ssh-key generate-api-key --label ci \
    --cmds new,ls,rm --exp 30d

Without --cmds the token only reads: help, ls, whoami, ssh-key list and share show. Without --exp it lasts 30 days; --exp ‘never’ makes one that does not expire.

--cmds takes full command names with their subcommand, ‘ssh-key list’ or ‘billing cap’ for instance, and ‘ssh name’ for one VM; short forms such as ‘ssh-key rm’ are refused. A list with spaces is quoted twice, once for ssh:

$ ssh chroot.dev ssh-key generate-api-key --label ci \
    --cmds "'new,ls,rm,ssh-key list'"

‘ssh’ on every VM, ‘ssh-key add’, ‘ssh-key generate-api-key’ and ‘browser’ give more than the token and need --escalate. What a token makes, a token or a browser session, expires with it at the latest; see ssh-key(1).

POST the command line to /exec; the answer is the --json output of the command:

$ curl -X POST -H "Authorization: Bearer $TOKEN" \
    -d 'new -n ci-1234 -w' https://chroot.dev/exec

/exec takes POST only; any other method gets 405, kind invalid, with ‘Allow: POST’. help answers its text as ‘text/plain’, not JSON. status runs over ssh only; see status(1).

/exec moved from chroot.run to chroot.dev: point clients at https://chroot.dev/exec, as a redirect from chroot.run drops the ‘Authorization’ header. Tokens made before the move work at chroot.dev until November 8, 2026, 00:00 UTC; then make a new one with ‘ssh-key generate-api-key’. Those made without --cmds now only read.

‘ssh name command’ runs command in the VM. The token needs ‘ssh name’ in --cmds, or ‘ssh’ with --escalate for every VM:

$ ssh chroot.dev ssh-key generate-api-key --label ci-run \
    --cmds "'ssh ci-1234'"

command is the rest of the body, passed as written to the VM's shell. Output and errors come back together; the exit status is in the ‘X-Fcm-Exit’ header:

$ curl -sD - -X POST -H "Authorization: Bearer $TOKEN" \
    -d 'ssh ci-1234 make test' https://chroot.dev/exec

The output is held until the command ends, up to 16 MiB; past that the answer is 502, kind unavailable. With the request header ‘TE: trailers’, the output streams as it comes, with no size limit, and ‘X-Fcm-Exit’ is a trailer after it, announced by ‘Trailer: X-Fcm-Exit’; a command cut at 30 seconds ends without it. curl(1) with -D prints the trailer after the output:

$ curl -sND - -X POST -H "Authorization: Bearer $TOKEN" \
    -H 'TE: trailers' -d 'ssh ci-1234 make test' \
    https://chroot.dev/exec

To pass ‘feature; v2’ to ‘deploy’ as one argument, quote it as the VM's shell would:

$ curl -X POST -H "Authorization: Bearer $TOKEN" \
    -d "ssh ci-1234 deploy 'feature; v2'" https://chroot.dev/exec

A failed command answers with the error as JSON, the same object as --json over ssh (see intro(1)), and an HTTP status from its kind:

400
invalid
403
denied or limit
404
not_found
409
conflict
500
internal
503
unavailable

Errors before the command runs (no token, an empty body, a body over 64 KiB) have the same shape without a reference, with 401, 400 or 413. An invalid or expired token gets 401, kind denied, with the reason and its reference in the error text.

A command gets 30 seconds; past that the answer is 504, kind unavailable. A lobby command may still finish (ls or stat show it); the connection of ‘ssh name command’ is closed.

Removing the label removes every key with it, so every token labelled ‘ci’:

$ ssh chroot.dev ssh-key rm ci

intro(1), ssh-key(1), status(1)

chroot.devOctober 14, 2026API(7)