Home Tutorials Categories Skills About
ZH EN JA KO
Security-Ops

Health Check API Explained

· 6 min read

Health Check Overview

The health check API is a built-in endpoint that reports the service's running status. It is used by load balancers, monitoring systems, and container orchestration platforms to determine whether the service is functioning properly.

Basic Health Check

curl http://localhost:3000/health

Response:

{ "status": "ok", "timestamp": "2026-03-11T08:00:00Z" }

HTTP status codes: 200 = healthy, 503 = unhealthy.

Detailed Health Check

curl http://localhost:3000/health/detailed

Returns comprehensive status including providers, channels, memory, and disk information.

Liveness vs. Readiness

Liveness: Is the process running?

curl http://localhost:3000/health/live
# Returns 200 as long as the process is running

Readiness: Is the service ready to accept requests?

curl http://localhost:3000/health/ready
# Returns 200 only after all dependencies are ready

Kubernetes Integration

containers:
  - name: openclaw
    livenessProbe:
      httpGet:
        path: /health/live
        port: 3000
      initialDelaySeconds: 10
      periodSeconds: 15
    readinessProbe:
      httpGet:
        path: /health/ready
        port: 3000
      initialDelaySeconds: 20
      periodSeconds: 10

Docker Health Check

services:
  openclaw:
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 20s

Prometheus Metrics

{
  "gateway": {
    "metrics": { "enabled": true, "path": "/metrics", "format": "prometheus" }
  }
}

Alert Configuration

{
  "gateway": {
    "healthCheck": {
      "alerts": {
        "enabled": true,
        "channels": ["telegram-admin"],
        "conditions": [
          {"check": "provider", "status": "down", "for": "2m"},
          {"check": "memory", "above": 90, "for": "5m"},
          {"check": "channel", "status": "disconnected", "for": "1m"}
        ]
      }
    }
  }
}

Summary

The health check API is a core component for production operations. By properly configuring liveness checks, readiness checks, and alerting, you can achieve rapid fault detection and auto-recovery to ensure high availability.

OpenClaw is a free, open-source personal AI assistant that supports WhatsApp, Telegram, Discord, and many more platforms