Health check
Response
true if server is healthy, false if recovering from errorsBrowser engine name:
"camoufox"true if browser is currently running and connectedtrue if browser process is active (same as browserConnected)Total number of open tabs across all sessions
Number of consecutive navigation failures. Browser auto-restarts after 3 failures.
true if browser is currently restarting after detecting unhealthy stateHealth states
| State | Condition | HTTP Status |
|---|---|---|
| Healthy | ok: true, browser running | 200 OK |
| Not started | ok: true, browserConnected: false | 200 OK |
| Recovering | recovering: true | 503 Service Unavailable |
| Unhealthy | consecutiveFailures >= 3 | 200 OK (auto-restart triggered) |
Browser lifecycle
- Browser launches lazily on first request (tab creation, navigation, etc.)
- Browser shuts down after 5 minutes of inactivity when no sessions exist (configurable via
BROWSER_IDLE_TIMEOUT_MS) - Browser auto-restarts after 3 consecutive navigation failures
Examples
Healthy (browser running):Start browser
Response
true if browser started successfullytrue after successful launchExample
Notes
- If browser is already running, this endpoint is a no-op and returns success
- First browser launch downloads Camoufox (~300MB) if not already installed
- Subsequent launches take 2-5 seconds
Stop browser
Authentication
Bearer token matching the
CAMOFOX_ADMIN_KEY environment variable:CAMOFOX_ADMIN_KEY is not set, this endpoint returns 403 Forbidden.
Response
true if browser was stopped successfullyfalse after shutdownExample
Shutdown sequence
- All user sessions are closed (browser contexts)
- All open tabs are closed
- Browser process is terminated
- Browser will relaunch on the next request
Error responses
Missing or invalid admin key:Auto-recovery
The server automatically monitors browser health and restarts when necessary:Failure detection
- Tracks consecutive navigation failures
- After 3 consecutive failures, browser is considered unhealthy
- All sessions are closed and browser restarts
- Success resets the failure counter
Disconnection handling
- If browser disconnects unexpectedly, all sessions are cleared
- Browser relaunches on the next request
- Clients receive 500 errors during recovery
Idle shutdown
- When no sessions exist for 5 minutes (default), browser shuts down to free memory
- Server idle memory usage: ~40MB
- Browser relaunches on the next tab creation
Configuration
| Variable | Description | Default |
|---|---|---|
BROWSER_IDLE_TIMEOUT_MS | Time before idle shutdown (0 = never) | 300000 (5 min) |
SESSION_TIMEOUT_MS | Session inactivity timeout | 1800000 (30 min) |
HANDLER_TIMEOUT_MS | Max time for navigation/interaction | 30000 (30s) |