Run a command in the workspace
A bash command in the project's root, on a working copy of the draft in the site's own container: rg, grep, sed, find, cat, node. A build of the project is refused (400): workspace:commit sends the files through the same checks as every change and starts the real build, whose errors getSiteBuild reports. No network, at most 300 s. Files it changes stay uncommitted (listed in uncommitted) until workspace:commit. The workspace follows the draft: another change carries your uncommitted edits over.
POST/v1/sites/{site_id}/workspace:run
Requires sites:write. Costs no credits. The path ends in /workspace:run.
The workspace is a shell on a working copy of the site’s draft, in the site’s own container, offline. Use it for what a shell does well: rg, grep, find, cat, sed -i, node, and npx astro build to try a build in seconds. The command runs in the project’s root as an unprivileged user, and there is no network.
What the command changes stays uncommitted. The response lists those changes in uncommitted, one per line in the style of git status (M src/pages/index.astro). Nothing reaches the history until you commit the workspace, and visitors see nothing until you publish.
command is at most 8000 characters. timeout_ms is between 1000 and 300000 and defaults to 60000: a command still running at that point is stopped and timed_out is true. A command that fails is not an API error: the call succeeds and exit_code is not 0. output holds stdout and stderr together; past 8 KB it keeps the start and the end and truncated is true.
The workspace follows the draft. When another change has moved the draft since your last command, your uncommitted edits are carried over and note says so, the same when the workspace had to be rebuilt.
A site that is still being created answers result_not_ready, and a suspended or deleting site answers conflict.
Authorizations
Authorizationbearerin headerrequiredPath parameters
site_idstringrequiredThe site's id, or its slug (the address before .atelier201.page).
Body
application/jsonrequiredcommandstringrequiredlength: 1–8000 charsA bash command, run in the project's root on a working copy of the draft: rg, grep, sed, find, cat, node... No network. Files it changes stay uncommitted until workspace:commit, which builds them and reports any build error. A build of the project here is refused: it took 30 s and duplicated that build.
timeout_msintegerrange: 1000–300000Default 60000. The command is stopped past it.
Response
Run a shell command on the site's workspace
dataobjectrequiredrequest_idstringrequiredPossible codes: invalid_request, unknown_field, invalid_parameter, invalid_cursor
errorobjectrequiredrequest_idstringrequiredPossible codes: authentication_required, invalid_api_key, api_key_expired, api_key_revoked
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_credits
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_scope, feature_not_available, admin_required
errorobjectrequiredrequest_idstringrequiredPossible codes: resource_not_found
errorobjectrequiredrequest_idstringrequiredPossible codes: conflict, result_not_ready, idempotency_key_reused
errorobjectrequiredrequest_idstringrequiredPossible codes: result_expired
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large_for_plan
errorobjectrequiredrequest_idstringrequiredPossible codes: rate_limited
errorobjectrequiredrequest_idstringrequiredPossible codes: internal_error
errorobjectrequiredrequest_idstringrequiredPossible codes: service_unavailable
errorobjectrequiredrequest_idstringrequired