Skip to documentation
API + guides

01Documentation

Hosting OpenClaw

Run OpenClaw inside a Sandbox0 sandbox when you want its gateway, workspace, logs, and session state behind Sandbox0 lifecycle and network controls. The builtin openclaw template stores /home/node/.openclaw on the sandbox writable rootfs, so checkpointed pause/resume preserves that state.

Create The Sandbox#

Set separate tokens for the Sandbox0 public route and the OpenClaw gateway:

bash
export OPENCLAW_GATEWAY_TOKEN="$(openssl rand -hex 32)" export OPENCLAW_ROUTE_TOKEN="$(openssl rand -hex 32)"

Claim the builtin template with auto_resume and expose port 18789 as a cmd Sandbox Service. The service command can be:

bash
exec openclaw gateway run \ --allow-unconfigured \ --auth token \ --token "$OPENCLAW_GATEWAY_TOKEN" \ --bind lan \ --port "$SANDBOX0_SERVICE_PORT"

Protect the public route with bearer auth using the SHA-256 digest of OPENCLAW_ROUTE_TOKEN. Set resume: true on the route so a request can resume a paused sandbox before it reaches OpenClaw.

With the CLI, create the runtime first and then configure services through an SDK or the Sandbox Services API:

bash
SANDBOX_ID="$( s0 -o json sandbox create --template openclaw \ | jq -r '.ID // .id' )" s0 sandbox get "$SANDBOX_ID"

Persistence#

Files under /home/node/.openclaw use the same persistence boundary as the rest of the writable rootfs. Pause checkpoints them; resume restores them into the replacement runtime Pod. Deleting the sandbox deletes its rootfs state.

Create a named rootfs snapshot before deletion when you need a reusable restore point or want to claim another sandbox from the initialized OpenClaw state.

Use The Public URL#

bash
curl -fsS "$OPENCLAW_PUBLIC_URL/health" \ -H "authorization: Bearer $OPENCLAW_ROUTE_TOKEN"

Running processes, sockets, and memory are not checkpointed. After resume, Sandbox0 starts the configured service command again against the restored rootfs.

Next Steps#