Health Check
GET /api/v1/health
Returns the operational status of PayWarden and all dependent services. No authentication required.
http
GET /api/v1/healthResponse 200 — healthy:
json
{
"status": "ok",
"version": "1.0.0",
"uptime": 3600,
"db": "ok",
"redis": "ok",
"chain_watcher": "ok",
"last_block_scanned": 65432100,
"last_block_at": "2025-01-01T00:05:00Z"
}Response 503 — degraded:
json
{
"status": "degraded",
"db": "ok",
"redis": "error",
"chain_watcher": "ok",
"error": "Redis connection refused"
}Fields
| Field | Type | Description |
|---|---|---|
status | "ok" | "degraded" | Overall health |
version | string | PayWarden version |
uptime | number | Process uptime in seconds |
db | "ok" | "error" | PostgreSQL connectivity |
redis | "ok" | "error" | Redis connectivity |
chain_watcher | "ok" | "paused" | "error" | Blockchain polling status |
last_block_scanned | number | Most recent block number checked (block scan mode) |
last_block_at | string | Timestamp of last block scan |
Usage
Docker Compose health check
PayWarden's docker-compose.yml includes a built-in health check:
yaml
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/v1/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10sThe container is marked unhealthy if health check fails 3 times consecutively, triggering an automatic restart.
Uptime monitoring
Use this endpoint with uptime monitors like:
- UptimeRobot — free, 5-minute checks
- Better Uptime — 1-minute checks, status page included
- Grafana — with Prometheus exporter (see monitoring guide)
bash
# Simple shell check
curl -sf http://localhost:3000/api/v1/health | jq '.status'Kubernetes liveness / readiness
yaml
livenessProbe:
httpGet:
path: /api/v1/health
port: 3000
initialDelaySeconds: 15
periodSeconds: 30
readinessProbe:
httpGet:
path: /api/v1/health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10