Health Endpoints
Health endpoints for monitoring API status. No authentication required.
Health Check
Section titled “Health Check”GET /health
Section titled “GET /health”Overall health check for the API.
Response (200 OK):
{ "status": "Healthy"}Response (503 Service Unavailable):
{ "status": "Unhealthy", "details": "Database connection failed"}Readiness Probe
Section titled “Readiness Probe”GET /health/ready
Section titled “GET /health/ready”Readiness probe for load balancers. Returns 200 when the service is ready to accept traffic.
Response (200 OK):
{ "status": "Ready"}Response (503 Service Unavailable):
{ "status": "NotReady", "details": "Warming up"}Use this endpoint for:
- Kubernetes readiness probes
- Load balancer health checks
- Deployment verification
Liveness Probe
Section titled “Liveness Probe”GET /health/live
Section titled “GET /health/live”Liveness probe to confirm the application is running.
Response (200 OK):
{ "status": "Alive"}Use this endpoint for:
- Kubernetes liveness probes
- Basic uptime monitoring
- Container orchestration
Usage Examples
Section titled “Usage Examples”Kubernetes Configuration
Section titled “Kubernetes Configuration”apiVersion: v1kind: Podspec: containers: - name: app livenessProbe: httpGet: path: /health/live port: 80 initialDelaySeconds: 5 periodSeconds: 10 readinessProbe: httpGet: path: /health/ready port: 80 initialDelaySeconds: 5 periodSeconds: 5Load Balancer Health Check
Section titled “Load Balancer Health Check”# Check if API is ready for trafficcurl -f https://api.terrascale.io/health/ready || exit 1Monitoring Script
Section titled “Monitoring Script”#!/bin/bash# Simple uptime check
response=$(curl -s -o /dev/null -w "%{http_code}" https://api.terrascale.io/health)
if [ "$response" = "200" ]; then echo "API is healthy"else echo "API is unhealthy: HTTP $response" # Send alertfiStatus Values
Section titled “Status Values”| Endpoint | Healthy Response | Unhealthy Response |
|---|---|---|
/health | Healthy | Unhealthy |
/health/ready | Ready | NotReady |
/health/live | Alive | Dead |
Best Practices
Section titled “Best Practices”- Use appropriate endpoints -
/livefor container restarts,/readyfor traffic routing - Set reasonable timeouts - Health checks should complete within 5 seconds
- Monitor response times - Slow health checks may indicate issues
- Don’t over-check - Every 10-30 seconds is usually sufficient
Next Steps
Section titled “Next Steps”- API Overview - Full API documentation
- Error Handling - Handle API errors
- Rate Limits - Understand limits