Learn

What is a Health Check Endpoint?

A health check endpoint is an API route that reports whether your application is running correctly. It's the endpoint you point your monitoring service at to check uptime.

Common Paths

  • /health
  • /healthz
  • /api/health
  • /status
  • /_health

Simple vs. Comprehensive Health Checks

Simple (Liveness)

Just confirms the process is running. Returns 200 OK if the server can respond.

GET /health → 200 OK

Comprehensive (Readiness)

Checks dependencies too. Returns 200 only if everything the app needs is working.

{
  "status": "healthy",
  "checks": {
    "database": "ok",
    "redis": "ok",
    "stripe": "ok"
  }
}

Best Practices

  1. Keep it fast — Health checks should respond in under 500ms
  2. No authentication — Monitoring services need to access it without credentials
  3. Check critical dependencies — Database, cache, essential external services
  4. Return proper status codes — 200 for healthy, 503 for unhealthy
  5. Set timeouts — Don't let a slow dependency hang the health check

Example: Node.js/Express

app.get('/health', async (req, res) => {
  try {
    // Check database
    await db.query('SELECT 1');

    // Check Redis
    await redis.ping();

    res.status(200).json({
      status: 'healthy',
      timestamp: new Date().toISOString()
    });
  } catch (error) {
    res.status(503).json({
      status: 'unhealthy',
      error: error.message
    });
  }
});

What to Check

  • Database connection — Can you query the database?
  • Cache connection — Is Redis/Memcached reachable?
  • Critical APIs — Are essential external services responding?
  • Disk space — Do you have room to write logs?

Kubernetes Note

In Kubernetes, you'll often have separate endpoints: a liveness probe (is the process alive?) and a readiness probe (is it ready for traffic?). The liveness check should be simple; the readiness check can be comprehensive.

Monitor your health endpoint

Add your /health endpoint to UptimeSignal and we'll alert you when it fails.

Start monitoring free →

Related