Health Check

Monitor API availability and status.

Health Check Endpoint

Check if the API is operational.

Endpoint: GET /api/health

Authentication: Not required

Response:

{
  "status": "healthy",
  "timestamp": "2024-01-21T10:00:00Z",
  "version": "1.0.0"
}

Detailed Health Check

Get detailed status including dependencies.

Endpoint: GET /api/health/detailed

Authentication: Required (admin only)

Response:

{
  "status": "healthy",
  "timestamp": "2024-01-21T10:00:00Z",
  "version": "1.0.0",
  "services": {
    "database": "healthy",
    "cache": "healthy",
    "ai": "healthy"
  },
  "uptime": 1234567
}

Status Values

StatusDescription
healthyService is operational
degradedService is running with issues
unhealthyService is not operational

Using Health Checks

Use the health endpoint in your monitoring systems:

cURL:

curl -s "https://travelmode2.replit.app/api/health" | jq .status

Python:

import requests

response = requests.get("https://travelmode2.replit.app/api/health")
if response.json()["status"] == "healthy":
    print("API is operational")
else:
    print("API has issues")