Skip to main content
GET
Health Check
curl --request GET \
  --url https://api.example.com/
{
  "status": "<string>",
  "timestamp": "<string>",
  "total_dispositivos": 123,
  "dispositivos": {
    "ip": "<string>",
    "name": "<string>"
  }
}

Overview

The health check endpoint provides server status information and a summary of registered devices. This is useful for monitoring server availability and getting a quick overview of the system state.

Endpoint

GET /
No authentication required.

Response

status
string
Server status indicator (always “online” when responding)
timestamp
string
Current server timestamp in YYYY-MM-DD HH:MM:SS format
total_dispositivos
integer
Total number of registered devices (multi-device mode only)
dispositivos
object
Dictionary of registered devices with basic info (multi-device mode only)

Examples

Multi-Device Mode

curl -k https://localhost:5000/
Response:
{
  "status": "online",
  "timestamp": "2026-03-06 10:30:15",
  "total_dispositivos": 2,
  "dispositivos": {
    "principal": {
      "ip": "192.168.1.205",
      "name": "Entrada Principal"
    },
    "bodega": {
      "ip": "192.168.1.206",
      "name": "Bodega"
    }
  }
}

Single-Device Mode

curl http://localhost:5000/
Response:
{
  "status": "online",
  "device_ip": "192.168.1.205",
  "device_port": 4370,
  "timestamp": "2026-03-06 10:30:15"
}

Implementation Details

Multi-Device Mode (server.py)

The health check endpoint is implemented at line 295-302:
server.py
@app.route("/", methods=["GET"])
def health():
    return _json({
        "status":    "online",
        "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
        "total_dispositivos": len(DEVICES),
        "dispositivos": {k: {"ip": v["ip"], "name": v["name"]} for k, v in DEVICES.items()},
    })

Single-Device Mode (servidor.py)

The health check endpoint is implemented at line 84-91:
servidor.py
@app.route("/", methods=["GET"])
def health():
    return _json({
        "status":      "online",
        "device_ip":   ZK_IP,
        "device_port": ZK_PORT,
        "timestamp":   datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
    })

Use Cases

Health Monitoring

Use in monitoring systems to verify server availability

Load Balancers

Configure as health check endpoint for load balancer probes

Quick Status

Get instant overview of registered devices without authentication

Uptime Checks

Set up external uptime monitoring services

Notes

This endpoint does not require authentication and can be accessed by anyone with network access to the server.
The response format differs between single-device and multi-device modes. Check which mode you’re using to parse the response correctly.

Build docs developers (and LLMs) love