# REST and SSE overview

The admin server is HTTPS on `admin_bind_ip:admin_port`. The browser UI uses a REST API under `/api` and one Server-Sent Events stream; both need a browser session (a cookie plus a CSRF header on changes), so they are meant for the UI, not for scripts. For monitoring use `/healthz` and `/metrics`.

| Group | Routes |
|---|---|
| Static and monitoring | `/`, `/static/…` (the UI); `/healthz` (no login); `/metrics` (bearer token) |
| Session | `GET /api/auth/session`; `POST /api/auth/setup`, `/login`, `/logout`, `/password` |
| Status and runtime | `GET /api/status`, `/api/listeners`, `/api/system`, `/api/map`, `/api/metrics/series`; `PUT /api/listeners/{lid}/enabled`; `PUT /api/endpoints/{eid}/state`; `POST /api/endpoints/{eid}/check`, `/api/endpoints/{eid}/tls-certificate` |
| Configuration | `GET`/`PUT /api/config` (whole document, with `If-Match`), `GET /api/config/schema`, `GET /api/config/backups`, `POST /api/config/backups/{name}/restore` |
| Connections | `GET /api/connections`, `/api/connections/recent`, `/api/connections/{id}`; `POST /api/connections/{id}/close`, `/api/connections/close` |
| Logs, licence, security, metrics token | `GET /api/logs`; `GET`/`POST /api/license`; `POST /api/security/test-ip`, `/api/security/block`; `POST`/`DELETE /api/metrics/token` |
| Events | `GET /api/events`: `hello`, `tick` (1 per second), `listener`, `notice`, `config`, `hb`, `reset`, `bye` |

In safe mode only the static files, `/healthz` (always 503), `GET /api/auth/session`, login and logout, `/api/status`, the backup list and restore, and `/api/logs` work; the rest answers 503 `safe_mode`.
