Run a sandbox command
Changed on<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>
Runs a shell command inside the app's sandbox with bash and returns its output.
Every sandbox-bridge endpoint runs against the app's live sandbox, the same filesystem the AI edits, so a change here is visible in the app editor immediately.
A command that exits non-zero still answers 200. Read exit_code to tell a failed command from a failed request, and expect stderr to carry output on success too, since many tools log there.
Each call starts in the app root unless you set cwd, and cd does not carry over between calls, so chain directory changes inside one command instead. The default timeout is 120000 ms and the maximum is 600000 ms; a command that outruns its timeout answers 504. Output is capped at 1 MB per stream, and truncated tells you when that happened.
If a background save holds the sandbox for more than about 30 seconds, the call answers 409 with SANDBOX_BUSY; retry in a minute.
This endpoint is limited to 30 requests per minute per app, its own budget rather than one shared with the other sandbox-bridge endpoints.
<Warning>A write is committed, not checkpointed. Only checkpoints appear in the app editor's version history, and a Restore or Revert there rolls the app back to the last checkpoint and discards everything written after it. Call Create a sandbox checkpoint when you finish a unit of work and before you stop.</Warning>
<Note>Where sandbox calls are metered, the bridge is open to every plan: each call is charged to the app's integration credits and a workspace that has none left answers 402 with CREDITS_EXHAUSTED. Otherwise the bridge needs a Builder plan or higher on the app's workspace, and answers 402 below that (PREMIUM_REQUIRED). Workspace API keys are not authorized and are rejected with a 403, and it is unavailable for agent apps. A personal API key works as-is. An OAuth access token needs the sandbox:write scope.</Note>
<Tip>Every error response carries a stable extra_data.code alongside the human-readable message. Branch on the code rather than on the message text or the status.</Tip>
Request
- Base URLhttps://app.base44.com
- URLhttps://app.base44.com/api/apps/{app_id}/sandbox-bridge/run_command
- AuthHTTP bearer
Path parameters
ID of the app whose sandbox to operate on.
Request body
Response
The command ran. Read exit_code for its result.
Example response
{
"stdout": "added 12 packages in 3s\n",
"duration_ms": 3120,
"unsaved_large_files": []
}Changes
- info
added the required property
to the response with the status
- info
- info
the endpoint scheme security
PersonalAccessTokenAuthwas added to the API
- info