# Homelable Backend API Reference

Direct REST API access to Pouzor/homelable visualizer backend on port 9445. Bypasses the complex and slow Server-Sent Events (SSE) handshake required on port 8001.

## Authentication
The backend API requires an unauthenticated sub-app service key. Read this key dynamically from:
`/srv/configs/docker_compose/homelabel/.env` -> `MCP_SERVICE_KEY`

Inject it into HTTP request headers:
`X-MCP-Service-Key: <MCP_SERVICE_KEY>`

## Endpoints

### 1. Health Check
`GET http://localhost:9445/api/v1/health`
Returns `{"status": "ok"}` on success (HTTP 200).

### 2. Retrieve Canvas Nodes
`GET http://localhost:9445/api/v1/nodes`
Returns a JSON array of active canvas nodes.

Example Node Object:
```json
{
  "type": "computer",
  "label": "Game Pc",
  "hostname": "DESKTOP-BRHGMFT",
  "ip": "10.0.0.109",
  "status": "online",
  "services": [
    {
      "port": 11434,
      "protocol": "tcp",
      "service_name": "Ollama"
    }
  ],
  "id": "3fc16e75-9418-41b1-b4a2-d3859c9ce431"
}
```

### 3. Retrieve Canvas Edges
`GET http://localhost:9445/api/v1/edges`
Returns active connection edges between nodes.

### 4. Trigger Network Scan
`POST http://localhost:9445/api/v1/scan/trigger`
