Skip to main content

Health API

Monitor system health and configure heartbeat schedules.

Health check (web)

No authentication required. Returns system health status.
The backend service exposes its own health check at GET /health (without the /api prefix). The web and backend health endpoints are independent — the web endpoint reports on the web application process while the backend endpoint reports on the API service. See backend health check below for details.
Breaking change: The health endpoint no longer returns cpu, memory, or uptime fields. These hardware details are now restricted to the admin-only endpoint at /api/admin/health. If you were consuming CPU, memory, or uptime data from this endpoint, update your integration to use the admin endpoint instead.

Response

The health field reflects overall system status based on internal CPU and memory thresholds:

Degraded and unhealthy responses

When the system is degraded or unhealthy, the endpoint still returns HTTP 200 with the health field set to degraded or unhealthy. The status field remains ok.

Error response

An HTTP 500 is returned only when an unexpected error occurs while collecting health metrics, not for degraded or unhealthy status:

Platform version

No authentication required. Returns the current platform version string read from the embedded VERSION file.

Response headers

Response

Dashboard health

No authentication required. Checks connectivity to backend services and returns their individual statuses. Use this endpoint to display an aggregated service health overview on a dashboard.

Response headers

Response

The status field for each service reflects the result of an HTTP health probe with a 6-second timeout per candidate URL. When all candidates fail, the primary URL is retried once with an 8-second timeout for diagnostic detail: When a service is down, the detail field contains a normalized error label rather than the platform’s raw error string. Possible values include timeout (8s), dns error, connection refused, connection reset, socket error, or unreachable.
The Borg-7139 (formerly Tempo Soul) probe attempts the configured SOUL_SERVICE_URL first at /soul/status, then falls back through /health, /healthz, and /readyz on the same host before trying /soul/status and /health on the canonical borg-0-production-7139.up.railway.app host. This fallback chain ensures that a stale SOUL_SERVICE_URL value does not surface a misleading HTTP 404 while the canonical Borg host is healthy. A host is considered healthy when any candidate returns HTTP 2xx; the response body is parsed for an active, ready, status, or build field to populate the detail. Railway uses a TCP port check on port 4023 instead of an HTTP health check for this service.

Backend health check

No authentication required. Returns backend service status including Railway API availability. This endpoint is served by the backend API service (without the /api prefix).
The backend API continues to serve non-provisioning endpoints (health, metrics, auth, AI, registration) even when the Railway API is not reachable. Agent provisioning and lifecycle operations are disabled until the Railway API becomes available.

Response

Response when the Railway API is unavailable

When the Railway API is not reachable, the health endpoint still returns HTTP 200 but reports degraded capabilities:
When provisioning is disabled, any request to a provisioning-dependent endpoint (such as deploying, starting, stopping, or restarting an agent) returns a 500 error. Non-provisioning endpoints continue to operate normally.
The provider field currently returns render for backward compatibility. Agent containers are now provisioned on Railway. This value may be updated to railway in a future release.

Get heartbeat settings

Requires session authentication. Returns the heartbeat configuration for a specific agent. The endpoint first queries the OpenClaw gateway for a heartbeat cron job. If the gateway returns a matching job, the response uses the gateway data. If the gateway is unavailable or no heartbeat job exists, the endpoint falls back to the database.
The source field in the response indicates where the data came from: gateway when read from the gateway’s cron scheduler, or db when read from the database fallback.

Query parameters

Response (gateway source)

When the gateway has a heartbeat cron job configured:

Response (database fallback)

When no gateway heartbeat job is found and agentId is provided:
When saved settings exist in the database, the response includes the stored enabled and frequency values. When no agentId is provided and no gateway heartbeat is found:

Errors

Update heartbeat settings

Requires session authentication. Updates heartbeat settings for a specific agent. The endpoint first attempts to write the heartbeat as a cron job on the OpenClaw gateway. If the gateway write succeeds, the response indicates source: "gateway". If the gateway is unavailable or the write fails, the settings are saved to the database as a fallback.
Breaking change: This endpoint now uses the PUT method instead of POST. The POST method is deprecated and may be removed in a future release. Update your integration to use PUT.

Request body

Response (gateway source)

Response (database fallback)

Errors

Delete heartbeat settings

Deprecated: The DELETE /api/heartbeat endpoint is deprecated. To disable heartbeats, use PUT /api/heartbeat with "enabled": false instead. When using the gateway, you can also remove the heartbeat cron job directly via DELETE /api/cron?jobId=heartbeat. See the cron API.
Requires session authentication. Resets heartbeat configuration for a specific agent by removing saved settings from the database.

Request body

Response

Errors

Runtime status classification

All health-related endpoints that report agent status use a shared runtime probe. The probe checks three endpoints on each agent service in parallel:
GET /api/status is the authoritative health signal. The Railway wrapper uses /api/status as the primary health check. The legacy /healthz and /readyz endpoints may legitimately return 404 on some deployments and should not be treated as the sole indicator of agent health.
The probe classifies agent status using the following priority:
  1. If /api/status returns 200:
    • configured: false → status is setup
    • running: true or state: "running" → status is running (even if /healthz and /readyz return 404)
    • running: false or state: "stopped" → status is stopped
    • Other states → falls back to legacy probe results
  2. If /api/status does not return 200:
    • /healthz and /readyz both 200 → status is healthy
    • /healthz 200 but /readyz not 200 → status is starting
    • All probes fail → status is unreachable
The following endpoints use this shared classification:

Container health checks

Agent services run the official OpenClaw image, which exposes built-in health endpoints on port 18789. The backend uses these to determine service readiness during provisioning and ongoing monitoring.

Built-in health endpoints

The OpenClaw image (ghcr.io/openclaw/openclaw:2026.4.27) provides three health endpoints on each agent service: All endpoints are unauthenticated and bind to the service’s internal port (18789).

/api/status response

/healthz response

The /healthz endpoint may return 404 on deployments where the legacy health route is not registered. Use /api/status as the primary health check instead.

/readyz response

The /readyz endpoint may return 404 on deployments where the legacy readiness route is not registered. Use /api/status as the primary health check instead.

Container health statuses

Health check behavior

  • The shared runtime probe checks /healthz, /readyz, and /api/status in parallel. /api/status is the authoritative signal.
  • The health check uses a 5-second timeout for /healthz and /api/status, and a 4-second timeout for /readyz.
  • The waitForHealthy function polls service health every 2 seconds, with a default overall timeout of 60 seconds.

Watchdog monitoring

The backend runs a per-agent watchdog that continuously monitors agent health, detects crash loops, and performs automatic recovery. The watchdog operates internally and does not expose dedicated API endpoints. Status information is surfaced through the existing agent status and lifecycle endpoints.

Health check cycle

The watchdog probes each agent’s gateway using the shared runtime probe (which checks /api/status, /healthz, and /readyz). Health checks run on a configurable interval (default: every 2 minutes). When the probe reports the agent as unhealthy or unreachable, the watchdog transitions the agent to a degraded state and increases the check frequency to every 5 seconds.

Lifecycle states

The watchdog tracks the following lifecycle states for each agent:

Auto-repair

When the watchdog detects an unhealthy agent, it can automatically attempt recovery. Auto-repair is enabled by default and can be disabled by setting the WATCHDOG_AUTO_REPAIR environment variable to false. The repair sequence is:
  1. Kill the agent gateway process
  2. Wait 5 seconds
  3. Restart the gateway
  4. Wait 30 seconds (startup grace period)
  5. Verify health
If the repair fails, the watchdog retries up to the configured maximum (default: 2 attempts). After exhausting all repair attempts, the agent transitions to the crash_loop state.

Crash loop detection

The watchdog tracks crash timestamps within a sliding window (default: 5 minutes). When the number of crashes in the window reaches the threshold (default: 3), the agent enters the crash_loop state. This prevents infinite restart loops for agents with persistent failures.

Notifications

The watchdog sends notifications for critical events (degraded, crash loop, repair attempts) through configured channels:
  • Telegram — when TELEGRAM_BOT_TOKEN and TELEGRAM_ADMIN_CHAT_ID are set
  • Discord — when DISCORD_WEBHOOK_URL is set

Railway status webhook

Receives platform status notifications from Railway’s status page and deployment events from the Railway dashboard. This endpoint processes deployment events, incident updates, component status changes, and page-level notifications. Events are persisted to Redis so the dashboard can display real-time Railway status.
This endpoint accepts webhooks from both status.railway.com (incident and component updates) and the Railway dashboard (deployment events). Configure webhook subscriptions in both locations to point to this URL.

Authentication

The RAILWAY_WEBHOOK_SECRET environment variable must be configured. Every request must include the secret via one of the following methods: The secret is verified using a constant-time comparison to prevent timing attacks.
The webhook fails closed when RAILWAY_WEBHOOK_SECRET is not set. Unsigned POSTs are rejected with 503 Service Unavailable to prevent unauthenticated parties from injecting fake status notifications and poisoning the cached railway:status:latest record in Redis.

Request body

The endpoint accepts two payload formats: deployment events from the Railway dashboard and status-page events from Railway’s status page.

Deployment event

Sent by Railway when a deployment status changes.

Status-page event

Sent by Railway’s status page for incident and component updates. The payload follows the Railway status page webhook format.

Response

On success, the endpoint returns the received event along with the persisted record:
The record is stored in Redis under the key railway:status:latest with a 7-day TTL. When Redis is not configured (KV_REST_API_URL and KV_REST_API_TOKEN not set), the endpoint still processes the event and returns the record but does not persist it.

Error response

Returned when the request body is not valid JSON:

Example payloads

Deployment event

Incident event

Railway status polling

Returns the last-known Railway status from Redis. No authentication required. Use this endpoint to display Railway platform status on your dashboard.

Response

When a status event has been received and persisted:
When no events have been received:
When Redis is not configured (KV_REST_API_URL and KV_REST_API_TOKEN not set):