Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Restart the daemon with the same arguments

/v1/daemon/restartPOST
The daemon stops like POST /v1/daemon/stop, then runs the binary on disk again (or executable) with the same arguments and environment. Use it after a rebuild or an update. The pid stays the same; startedAt changes. Leases live in state.db and stay valid.
Authorizationoptional
bearerAuth?Bearer <token>
Required on the tunnel. An API token of the account, from ghosthand tunnel url --new-token. The unix socket needs no token
Request Bodyapplication/json
executable?string
Absolute path of another ghosthand binary to run, e.g. a newer version the CLI was installed as. Only over the unix socket; tunnel clients get 403.
Example: "/usr/local/bin/ghosthand"
ifIdle?boolean
Restart only when no lease is active; otherwise 409 daemon-busy and the daemon keeps running. macOS screen capture needs seconds to a minute after a restart, so an agent holding a lease would lose its screen. The CLI sets it when it restarts the daemon by itself.
Response
202 · The daemon is restarting
message *string
What the daemon did, for people and logs
Default · Error (RFC 9457 problem details). `code` is stable; switch on it, not on `title` or `detail`.
code *"invalid-request" | "unauthorized" | "not-found" | "device-not-found" | "no-device" | "multiple-devices" | "permission-denied" | "bluetooth-unavailable" | "bluetooth-disconnected" | "no-frame" | "device-locked" | "lock-failed" | "pairing-timeout" | "pointer-not-found" | "lock-state-unavailable" | "lockdown-unavailable" | "unlock-failed" | "mute-unconfirmed" | "text-not-found" | "wait-text-timeout" | "cancelled" | "lease-invalid" | "device-leased" | "recording-active" | "no-recording" | "recording-failed" | "daemon-busy" | "tunnel-offline" | "login-required" | "subscription-required" | "unsupported-in-mode" | "xctest-unavailable" | "task-failed" | "internal-error"
Stable error code. Switch on it; title and detail are for people.
title *string
Short summary of the code, the same for every error with this code
status *integer
HTTP status of the error. In stream mode the response status stays 200.
detail *string
What happened and what to do next. Agents should read it.
Request example
curl -X POST "https://ghosthand.dev/macs/studio/v1/daemon/restart" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "executable": "/usr/local/bin/ghosthand", "ifIdle": true }'
Response example
{ "message": "daemon restarting" }