HTTP API
Commands
5 routes your API key can call. Each says who may call it; every example assumes KEY is your API key. What only the dashboard does (signing in, making API keys, connecting accounts) isn't listed here: it's in the full OpenAPI spec.
/v1/workspaces/{wid}/sandboxes/{id}/commandsRun a shell command in a running sandbox
People and API keys
Starts the command and answers 201 at once, with status running. With ?wait=N (0 to 60 seconds) it holds the request until the command ends or N seconds pass; if it ended, output carries the first 64 KiB of stdout and stderr together, and truncated says whether there is more (read it from …/output). A stopped sandbox is 409 "sandbox is stopped".
| Parameter | In | Type | About |
|---|---|---|---|
wid | Inpath | Typestring | AboutWorkspace id |
id | Inpath | Typestring | About |
wait? | Inquery | Typeinteger | AboutSeconds to wait for it to finish |
Body
commandstringrequiredRun by the sandbox shell, e.g. "npm test; echo done"
cwdstringAbsolute; the provider's home directory when left out
envobjectNames are letters, digits and _, not starting with a digit
timeout_secondsintegerKilled after this; no limit when left out
Answer · 201
commandCommandrequiredidstringsandboxstringId of the sandbox it runs in
commandstringstatus"running" | "exited" | "timed_out" | "failed"failed: killed by a signal, lost, or never started
exit_codeinteger | nullstarted_atstringended_atstring | nulloutputstring | nullThe first 64 KiB of output, only when ?wait= saw it end
truncatedbooleanThere is more output than output holds
curl -X POST 'https://annex.eversonder.com/v1/workspaces/wsp_…/sandboxes/id/commands' \
-H 'Authorization: Bearer anx_live_…' \
-H 'Content-Type: application/json' \
-d '{"command":"…"}'/v1/workspaces/{wid}/sandboxes/{id}/commands/{cid}Where a command is now, asked of the provider. output is always null here.
People and API keys
| Parameter | In | Type | About |
|---|---|---|---|
wid | Inpath | Typestring | AboutWorkspace id |
id | Inpath | Typestring | About |
cid | Inpath | Typestring | AboutCommand id |
Answer · 200
commandCommandrequiredidstringsandboxstringId of the sandbox it runs in
commandstringstatus"running" | "exited" | "timed_out" | "failed"failed: killed by a signal, lost, or never started
exit_codeinteger | nullstarted_atstringended_atstring | nulloutputstring | nullThe first 64 KiB of output, only when ?wait= saw it end
truncatedbooleanThere is more output than output holds
curl -X GET 'https://annex.eversonder.com/v1/workspaces/wsp_…/sandboxes/id/commands/cid' \
-H 'Authorization: Bearer anx_live_…'/v1/workspaces/{wid}/sandboxes/{id}/commands/{cid}/cancelStop a running command, as Ctrl+C would
People and API keys
Sends the command and everything it started SIGINT, then SIGTERM 2 s later, then SIGKILL 2 s after that, and answers the command as it is then: usually ended, with the exit code its signal gave it (130, 143 or 137). 409 command_ended once it has ended; 409 command_unstoppable for a command started before commands could be stopped, or in a sandbox whose /tmp isn't writable.
| Parameter | In | Type | About |
|---|---|---|---|
wid | Inpath | Typestring | AboutWorkspace id |
id | Inpath | Typestring | About |
cid | Inpath | Typestring | AboutCommand id |
Answer · 200
commandCommandrequiredidstringsandboxstringId of the sandbox it runs in
commandstringstatus"running" | "exited" | "timed_out" | "failed"failed: killed by a signal, lost, or never started
exit_codeinteger | nullstarted_atstringended_atstring | nulloutputstring | nullThe first 64 KiB of output, only when ?wait= saw it end
truncatedbooleanThere is more output than output holds
curl -X POST 'https://annex.eversonder.com/v1/workspaces/wsp_…/sandboxes/id/commands/cid/cancel' \
-H 'Authorization: Bearer anx_live_…'/v1/workspaces/{wid}/sandboxes/{id}/commands/{cid}/outputOne page of a command's output, by cursor
People and API keys
Pages by cursor, not page number: output is a log that grows while the command runs and the provider drops its oldest lines, so there is no stable total. Start without cursor, then pass meta.next_cursor. meta.done is true once the command has ended and nothing follows; an empty page that isn't done means you have caught up with a command still running.
| Parameter | In | Type | About |
|---|---|---|---|
wid | Inpath | Typestring | AboutWorkspace id |
id | Inpath | Typestring | About |
cid | Inpath | Typestring | AboutCommand id |
cursor? | Inquery | Typestring | Aboutmeta.next_cursor of the page before; empty for the start |
perPage? | Inquery | Typeinteger | AboutChunks of output |
Answer · 200
outputOutputChunk[]requiredstream"stdout" | "stderr"textstringA chunk as written
metaobjectrequirednext_cursorstringdonebooleanperPageinteger
curl -X GET 'https://annex.eversonder.com/v1/workspaces/wsp_…/sandboxes/id/commands/cid/output' \
-H 'Authorization: Bearer anx_live_…'/v1/workspaces/{wid}/sandboxes/{id}/commands/{cid}/streamA command's output as Server-Sent Events, live
People and API keys
An "output" event per chunk of output (data is an OutputChunk; its id is a cursor), then one "exit" event whose data is the Command as it ended, and the stream closes. Reconnect with Last-Event-ID to resume after the last chunk you got. If the stream breaks after it opened, an "error" event says so. If the sandbox ended while it was open (stopped, or lost: code sandbox_lost with replaced_by and replacement_resume), one "gone" event whose data is the Error says so and the stream closes: don't reconnect. Errors before it opens (404, 409, 429, 503) are ordinary JSON. A workspace may have 8 of these open at once and a person or API key 4 (429 too_many_requests); 503 unavailable when the server is holding as many calls into sandboxes as it allows (retry shortly).
| Parameter | In | Type | About |
|---|---|---|---|
wid | Inpath | Typestring | AboutWorkspace id |
id | Inpath | Typestring | About |
cid | Inpath | Typestring | AboutCommand id |
Last-Event-ID? | Inheader | Typestring | About |
Answer · 200
event: output, data: {"stream":"stdout","text":"hi\n"} … event: exit, data: {Command}, or event: gone, data: {Error}
curl -X GET 'https://annex.eversonder.com/v1/workspaces/wsp_…/sandboxes/id/commands/cid/stream' \
-H 'Authorization: Bearer anx_live_…'