Skip to main content

Shell

Container-based command execution with filesystem access and artifact capture.

Create a shell session

curl -X POST https://api.browsr.dev/shell/sessions \
-H "x-api-key: $BROWSR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"language": "python",
"timeout_secs": 300
}'
ParameterTypeDescription
imagestringContainer image
languagestringRuntime language such as python or javascript
timeout_secsnumberSession timeout
imagestringOverride the default container image

Execute a command

curl -X POST https://api.browsr.dev/shell/exec \
-H "x-api-key: $BROWSR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "shell-abc123",
"command": "ls -la /workspace",
"timeout_secs": 30
}'
{
"stdout": "total 8\ndrwxr-xr-x 2 root root 4096 ...",
"stderr": "",
"exit_code": 0,
"duration_ms": 45,
"timed_out": false
}

Streaming execution

curl -X POST https://api.browsr.dev/shell/exec/stream \
-H "x-api-key: $BROWSR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"session_id": "shell-abc123", "command": "pip install pandas && python script.py"}'

Filesystem operations

MethodEndpointDescription
POST/shell/fs/readRead a file
POST/shell/fs/writeWrite a file
POST/shell/fs/listList directory
POST/shell/fs/treeDirectory tree
POST/shell/fs/searchSearch files
POST/shell/fs/infoFile info
POST/shell/fs/deleteDelete file/dir
POST/shell/fs/copyCopy file/dir
POST/shell/fs/moveMove file/dir
POST/shell/fs/mkdirCreate directory

Artifacts

Output mounts are automatically captured as artifacts after execution.

# List artifacts for a session
curl https://api.browsr.dev/shell/artifacts/by-session/shell-abc123 \
-H "x-api-key: $BROWSR_API_KEY"

# Download an artifact file
curl https://api.browsr.dev/shell/artifacts/ARTIFACT_ID/files/output.csv \
-H "x-api-key: $BROWSR_API_KEY"

List / delete sessions

# List
curl https://api.browsr.dev/shell/sessions \
-H "x-api-key: $BROWSR_API_KEY"

# Delete
curl -X DELETE https://api.browsr.dev/shell/sessions/shell-abc123 \
-H "x-api-key: $BROWSR_API_KEY"