API Reference
Complete REST API documentation for the MiBee Steward device management and monitoring system (including device systems, network scanning, multi-subnet agents, notifications and audit).
Table of Contents
Overview
-
Base URL:
/api/v1(except/metricsand/sd) -
Content-Type:
application/json(file uploads usemultipart/form-data) -
Auth: JWT cookie-first + Bearer header fallback (see Authentication & Accounts)
-
Error envelope: All errors use
{"error": "message"}format -
Capability gating: Endpoints are gated by capability matrix rather than a uniform role check (see Authentication & Accounts)
API Contract (#274)
The conventions every endpoint follows. The machine-readable form of this section is docs/openapi.yaml (kept in sync with the implementation by a CI parity test); this is the prose contract.
List envelope
Every list endpoint returns an object, never a top-level array:
{ "<resource>": [ ... ], "total": 42, "limit": 20, "offset": 0 }
-
<resource>is the plural resource key (devices,users,changes,audit_logs, ...). One key per endpoint, see Pagination for the per-endpoint keys. -
totalis the filtered count (rows matching the query, not the page size). Two deliberate exceptions:GET /notification/logscarries the caller's unread count (the header badge), andGET /scanner/scanis a scan result, not a list. -
limit/offsetecho the effective pagination (after defaults and clamping), so a client can detect a server-side clamp. Complete, unpaginated collections (GET /networks,GET /networks/{id}/vlans,GET /subnets,GET /agents/tokens,GET /agents/status,GET /notification/channels|rules, topology graph, per-device sub-lists) omit them and always return every row. -
Machine channel exception:
GET /agents/commands(the agent poller endpoint) still returns a bare array, it is a fleet-internal contract consumed by deployed agent binaries, not a public integration surface; wrapping it would break every agent until upgraded.
Error model
{ "error": "human-readable message" }
One field, always present on non-2xx JSON responses (middleware and handlers share the shape). Status codes: 400 malformed input, 401 unauthenticated, 403 forbidden (capability/scope/CSRF), 404 not found (also used for out-of-scope resources, indistinguishable by design), 409 conflict (duplicate name), 413 payload too large (sync scan > 1024 IPs), 422 semantically invalid batch, 429 rate limited, 503 feature disabled (e.g. credential vault without master key).
Pagination
limit / offset query parameters, policy enforced identically everywhere (ParsePagination):
-
absent (or
0) → endpoint default -
malformed or negative → 400
-
over the endpoint max → clamped to the max (never an error; detect via the echoed
limit)
| Endpoint family | default | max |
|---|---|---|
| devices, users, documents, scanner results/runs/tasks, probe targets, device systems, notification logs | 20 | 100 |
| changes, agent commands (all), network grants | 50 | 200 |
| heartbeat results/history, audit logs | 50 | 500 |
| device config versions | 100 | 1000 |
| SNMP credentials | 100 | 1000 |
| SSH credentials | 50 | 200 |
Timestamps
All timestamps are RFC 3339 strings. Storage-derived fields carry the server's zone offset; integrators should parse with a full RFC 3339 parser (not a bare date parser).
Middleware Chain
Every request passes through the following middleware in source registration order:
flowchart LR
A[RequestID] --> B[RealIP] --> C[Logging] --> D[Metrics] --> E[Recoverer]
E --> F[CORS] --> G[SecurityHeaders] --> H[CSRF]
H --> I[Global Rate Limit] --> J["Auth/RBAC<br/>(+ Network Scope / Agent Token)"]
-
RealIPonly trustsX-Forwarded-Forwhen the TCP peer is inserver.trusted_proxies(default empty = trust no proxy); when directly exposed the TCP peer is used. Reverse proxy deployments must declare the proxy source range in configuration. -
Global rate limit defaults to 600 requests per minute per IP; login endpoints 10/min; scan triggers 10/min (see Rate Limiting).
Authentication & Accounts
Authentication uses JWT tokens with cookie-first and Bearer header fallback. All business endpoints require authentication except public endpoints.
JWT Flow
-
Login: Submit credentials to obtain a JWT token (set as HTTP-only cookie)
-
Usage: Subsequent requests automatically send the token via cookie
-
Fallback: If the cookie is unavailable, use the
Authorization: Bearer <token>header -
Expiry: Configurable (default 24 hours)
-
Logout: Blacklist the current token by jti until its expiry (server-side revocation) and clear the cookie
Roles & Capabilities
Access control is based on a capability matrix: each route group is gated by capability, roles map to capability sets, and admin inherits all capabilities.
| Capability Class | Capabilities | Roles |
|------------------|-------------|-------|
| Read | CapDeviceRead / CapNetworkRead / CapDiscoveryRead / CapChangesRead / CapTopologyRead / CapConfigRead / CapHeartbeatRead / CapDashboardRead / CapDocumentRead / CapNotificationRead / CapAuditRead | Any logged-in user (viewer and above) |
| Operations | CapDeviceWrite / CapScanTrigger / CapScanManage / CapHeartbeatManage / CapDocumentWrite | Operator and above (operator+) |
| Admin | CapUserManage / CapNetworkManage / CapCredManage / CapAgentManage / CapNotificationManage / CapDashboardManage | Admin only |
Roles: admin (full capabilities), operator (scan and write), viewer (read-only observer), user (legacy basic user).
Auth Levels
flowchart LR
P["Public"] --> R["Authenticated"]
R --> M["Capability-gated"]
-
Public: No authentication required (health check, login, logout, 2FA verification,
/metrics,/sd,/.well-known/mibee-service) -
Authenticated: Valid JWT token (any role)
-
Capability-gated: Valid JWT token holding the required capability, read capabilities for any logged-in user, operational capabilities for operator and above, manage capabilities for admin only
TOTP Two-Factor Authentication (2FA)
Accounts support TOTP-based two-factor authentication. Endpoints are at /api/v1/auth/2fa (the entire /auth group is subject to login rate limiting):
| Endpoint | Auth | Description |
|----------|------|-------------|
| POST /api/v1/auth/2fa/verify | Public · Login Rate Limit | Verify TOTP code (login two-factor verification step) |
| POST /api/v1/auth/2fa/setup | Authenticated | Get TOTP setup (generate secret / otpauth URI binding info) |
| POST /api/v1/auth/2fa/enable | Authenticated | Enable 2FA (after binding and confirming verification code) |
| POST /api/v1/auth/2fa/disable | Authenticated | Disable 2FA |
| GET /api/v1/auth/2fa/status | Authenticated | Query current account 2FA status |
Endpoints
POST /api/v1/auth/login
Authenticate user and return JWT token.
Public · 10 requests per minute rate limit
Request:
{
"username": "string", // accepts username or email
"password": "string"
}
Response:
{
"token": "string",
"user": {
"id": 1,
"username": "admin",
"email": "[email protected]",
"role": "admin",
"must_change_password": false,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
},
"two_factor_required": false
}
Every user object carries a must_change_password flag. Accounts with 2FA enabled have a challenge variant: after the password checks out, the response carries two_factor_required: true and no cookie/token is issued, complete the login by passing POST /auth/2fa/verify.
POST /api/v1/auth/register
Register a new user (admin only).
Admin Required · 10 requests per minute rate limit
Request:
{
"username": "string",
"email": "string",
"password": "string",
"role": "string" // optional, defaults to "user"
}
Response:
{
"id": 1,
"username": "user",
"email": "[email protected]",
"role": "user",
"must_change_password": false,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
POST /api/v1/auth/logout
User logout: blacklists the presented token by jti until its expiry (server-side revocation, stronger than clearing the cookie alone) and clears the client cookie.
Public (no auth gate; shares the login rate limit with the whole /auth group) · 10 requests per minute rate limit
Response: 200 OK with {"message": "logged out"}
Account Self-Service Endpoints
Self-service profile and password management for the current user (all require auth):
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/auth/profile | GET | Authenticated | Get current user profile |
| /api/v1/auth/profile | PUT | Authenticated | Update profile (email, required) |
| /api/v1/auth/password | PUT | Authenticated | Change password (old_password + new_password) |
| /api/v1/auth/force-password | PUT | Authenticated | Forced password change (first change after must_change_password is set, new_password only) |
Health
GET /api/v1/health
System health check, including database status.
Public
Response:
{
"status": "ok",
"db": "ok",
"version": "v0.1.0"
}
status is ok or degraded (when database ping fails). db is ok or error. version is the build version injected via ldflags (dev for untagged builds).
A root-level alias GET /health serves the same JSON. External monitors, container probes and load balancers that conventionally probe /health get real health status instead of the SPA fallback HTML (#571).
GET /.well-known/mibee-service
Ecosystem service discovery identity endpoint (#729, Scout docs/02 §8.1): the Scout app's subnet scan hits this to classify a discovered instance by type instead of hand-typing addresses. Unauthenticated and minimal by contract — exactly four fields, nothing about addresses, capabilities, or credentials (same disclosure posture as /health; it must be public because the app cannot authenticate before it has discovered the instance).
Public
Response:
{
"service": "steward",
"name": "steward-lan",
"ver": "v0.9.1",
"id": "6f0c8e2b1a4d5f379c8e0b2a4d6f8c1e"
}
service is always steward (the docs/02 §8.4 type registry value); name is the announced instance name (announce.name or the OS hostname); ver is the build version; id is the stable per-installation ID (data/instance-id, survives restarts/upgrades/IP changes — it is the app-side bind/merge anchor). Disabled with announce.enabled: false (404).
The same identity is also announced via mDNS _mibee-steward._tcp (TXT ver/id/name/tls/api, same shape as the NVR service) and a UDP responder on port 49091 answering the shared MIBEE-NVR-DISCv1? probe with type=steward — both configured under the announce block, see configuration.md.
Users & Network Grants
User management and network scope grant endpoints. All endpoints require Admin (CapUserManage).
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/users | GET | Admin | List all users (paginated) |
| /api/v1/users/{id} | DELETE | Admin | Delete a user (self-delete rejected) |
| /api/v1/users/batch-delete | POST | Admin | Batch delete users |
| /api/v1/users/{id}/reset-password | POST | Admin | Reset specified user's password |
| /api/v1/users/{id}/network-grants | GET | Admin | List networks granted to a user (visible scope in closed mode) |
| /api/v1/network-grants | GET | Admin | List all network grants |
| /api/v1/network-grants | POST | Admin | Create a network grant (grant a user access to a specified network, request includes user_id and network_id) |
| /api/v1/network-grants/{id} | DELETE | Admin | Delete a network grant |
Network scope grants take effect in closed scope mode (rbac.scope_default is closed): users can only see devices, scan tasks, and results within granted networks; out-of-scope device access returns 403, while unauthorized scan task/run/result details return 404. See Configuration Reference → Network Scope for management.
GET /api/v1/users
List all users.
Admin Required
Query Parameters:
-
search: Fuzzy search over username/email -
limit: Number of results (default: 20, max: 100) -
offset: Pagination offset
Response:
{
"users": [
{
"id": 1,
"username": "admin",
"email": "[email protected]",
"role": "admin",
"must_change_password": false,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
DELETE /api/v1/users/{id}
Deletes a user by ID. Self-deletion is rejected with 400 (cannot delete yourself, the same guard as batch delete); a non-existent ID returns 404. Audit-logged as admin.user.delete. Introduced in #568 — the endpoint the UI's row-level delete button always targeted, which previously did not exist (every delete answered 404).
Admin
POST /api/v1/users/{id}/reset-password
Reset user password (admin only). The target user must change their password on next login; login lockout state is also cleared.
Admin Required
Request:
{
"new_password": "new-secure-password"
}
Response:
{
"message": "password reset successfully"
}
Devices
Device registration and management with multi-protocol auto-discovery and identification.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/devices | GET | Authenticated · CapDeviceRead | List devices (filter + pagination) |
| /api/v1/devices | POST | Authenticated · CapDeviceWrite | Create a device |
| /api/v1/devices/stats | GET | Authenticated · CapDeviceRead | Device statistics (counts by status and type) |
| /api/v1/devices/export | GET | Authenticated · CapDeviceRead | Export device inventory |
| /api/v1/devices/{id} | GET | Authenticated · CapDeviceRead | Get device details |
| /api/v1/devices/{id} | PUT | Authenticated · CapDeviceWrite | Update a device |
| /api/v1/devices/{id} | DELETE | Authenticated · CapDeviceWrite | Delete a device |
| /api/v1/devices/batch-delete | POST | Authenticated · CapDeviceWrite | Batch delete devices |
| /api/v1/devices/batch-update-status | POST | Authenticated · CapDeviceWrite | Batch update device status |
Device read/write paths carry Network Scope (NetworkScope) filtering; device-level operations add a ValidateDeviceScope check, out-of-scope access in closed mode returns 403 ({"error":"forbidden: device out of network scope"}).
GET /api/v1/devices
List devices with filtering and pagination.
Authenticated · CapDeviceRead
Query Parameters:
-
status: Filter by status (online,offline,unknown) -
type: Filter by type (12 types:pc,server,switch,router,firewall,nas,camera,phone,printer,embedded,iot,other) -
search: Fuzzy search over name/IP/MAC etc. -
sort/order: Sort field and direction (asc/desc) -
created_from/created_to: Filter by creation time (YYYY-MM-DDor full timestamp) -
network_id: Filter to a single network (absent = all networks) -
limit: Number of results (default: 20, max: 100) -
offset: Pagination offset
Response:
{
"devices": [
{
"id": 1,
"name": "Server-01",
"type": "pc",
"brand": "Dell",
"model": "PowerEdge R740",
"location": "Data Center A",
"purpose": "Web Server",
"description": "Primary web hosting server",
"status": "online",
"ip_address": "192.168.1.100",
"mac_address": "00:1a:2b:3c:4d:5e",
"serial_number": "DELL123456",
"purchase_date": "2022-01-15",
"warranty_expiry": "2025-01-15",
"tags": "web,primary",
"scan_attributes": {
"vendor": "Dell Inc.",
"oui_prefix": "001A2B",
"oui_vendor": "Dell Inc.",
"mac": "00:1a:2b:3c:4d:5e",
"mac_is_locally_administered": false,
"mac_is_multicast": false,
"hostname": "server-01",
"os": "Linux",
"inferred_type": "server",
"inferred_type_source": "protocol",
"scan_source": "scanner_v2"
},
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
scan_attributes (scan-discovery aggregation written by the engine), a JSON object on each device carrying scan-discovered information. MAC/OUI-related fields:
| Field | Description |
|-------|-------------|
| vendor | Device self-reported brand (via SNMP sysObjectID / HTTP Server header / TLS cert CN); falls back to OUI vendor when none of the above match. |
| oui_prefix | IEEE-assigned block matched by longest prefix on the MAC, 6 hex (MA-L /24), 7 hex (MA-M /28), or 9 hex (MA-S /36). Empty when no OUI table is loaded or the MAC is unknown/locally administered. |
| oui_vendor | IEEE-registered organization name for oui_prefix, the NIC chip vendor, separate from vendor (they differ in OEM/rebrand/virtualization scenarios). |
| mac | Normalized lowercase MAC (aa:bb:cc:..). |
| mac_is_locally_administered | Neutral factual flag: U/L bit (first byte & 0x02) set, MAC is locally administered, not from an IEEE block. This bit cannot distinguish privacy randomization (unstable) from local fixed assignment (stable), so it is observation-only and does not change device identity. |
| mac_is_multicast | I/G bit (first byte & 0x01) set, a real device should never transmit from a multicast MAC; data hygiene flag. |
GET /api/v1/devices/stats
Get device statistics (counts by status and type). Supports an optional network_id query parameter (scope counts to a single network).
Authenticated · CapDeviceRead
Response:
{
"by_status": {
"online": 5,
"offline": 2,
"unknown": 1
},
"by_type": {
"pc": 4,
"embedded": 2,
"iot": 1,
"other": 1
}
}
GET /api/v1/devices/{id}
Get device details by ID.
Authenticated · CapDeviceRead
Response: Same as GET /api/v1/devices, but a single device object.
POST /api/v1/devices
Create a new device.
Authenticated · CapDeviceWrite
Request:
{
"name": "string",
"type": "string", // pc, server, switch, router, firewall, nas, camera, phone, printer, embedded, iot, other
"brand": "string",
"model": "string",
"location": "string",
"purpose": "string",
"description": "string",
"ip_address": "string",
"mac_address": "string",
"serial_number": "string",
"purchase_date": "string",
"warranty_expiry": "string",
"tags": "string"
}
Response: 201 Created with DeviceResponse.
PUT /api/v1/devices/{id}
Update a device (partial update using pointer fields).
Authenticated · CapDeviceWrite
Request:
{
"name": "string",
"type": "string",
"brand": "string",
"model": "string",
"location": "string",
"purpose": "string",
"description": "string",
"ip_address": "string",
"mac_address": "string",
"serial_number": "string",
"purchase_date": "string",
"warranty_expiry": "string",
"tags": "string"
}
Response: 200 OK with updated DeviceResponse.
DELETE /api/v1/devices/{id}
Delete a device.
Authenticated · CapDeviceWrite
Response: 200 OK with {"message": "device deleted"}
Device Systems
Device systems management for managing each system installed on a device, its entry URL and monitoring capabilities.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/devices/{id}/systems | GET | Authenticated · CapDeviceRead | List all systems on a device |
| /api/v1/devices/{id}/systems | POST | Authenticated · CapDeviceWrite | Create a new system for a device |
| /api/v1/devices/{id}/systems/{systemId} | GET | Authenticated · CapDeviceRead | Get system details |
| /api/v1/devices/{id}/systems/{systemId} | PUT | Authenticated · CapDeviceWrite | Update a system |
| /api/v1/devices/{id}/systems/{systemId} | DELETE | Authenticated · CapDeviceWrite | Delete a system |
GET /api/v1/devices/{id}/systems
List all systems on a device.
Authenticated · CapDeviceRead
Response:
{
"systems": [
{
"id": 1,
"device_id": 1,
"name": "Web Server",
"entry_url": "https://app.example.com",
"description": "Main web application",
"category": "web_app",
"metrics_url": "https://app.example.com/metrics",
"metrics_enabled": true,
"tags": "primary,web",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
POST /api/v1/devices/{id}/systems
Create a new system for a device.
Authenticated · CapDeviceWrite
Request:
{
"name": "string",
"entry_url": "string",
"description": "string",
"category": "string", // web_app, database, middleware, custom
"metrics_url": "string",
"metrics_enabled": true,
"tags": "string"
}
Response: 201 Created with SystemResponse.
GET /api/v1/devices/{id}/systems/{systemId}
Get system details by ID.
Authenticated · CapDeviceRead
Response: Same as GET /api/v1/devices/{id}/systems, but a single system object.
PUT /api/v1/devices/{id}/systems/{systemId}
Update a system (partial update using pointer fields).
Authenticated · CapDeviceWrite
Request:
{
"name": "string",
"entry_url": "string",
"description": "string",
"category": "string",
"metrics_url": "string",
"metrics_enabled": true,
"tags": "string"
}
Response: 200 OK with updated SystemResponse.
DELETE /api/v1/devices/{id}/systems/{systemId}
Delete a system.
Authenticated · CapDeviceWrite
Response: 200 OK with {"message": "device system deleted"}
Device Neighbors & Certificates
Read-only data on the device detail page: L2 neighbors and TLS certificates.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/devices/{id}/neighbors | GET | Authenticated · CapDeviceRead | List device L2 neighbors (Bridge-MIB / LLDP / CDP / ARP) |
| /api/v1/devices/{id}/certificates | GET | Authenticated · CapDeviceRead | List TLS certificate chains for device ports |
GET /api/v1/devices/{id}/neighbors
List discovered L2 neighbors (from Bridge-MIB / LLDP / CDP / ARP) for the device detail neighbor panel.
Authenticated · CapDeviceRead
Response: Neighbor list ({ neighbors: [...] }, with peer IP/MAC and discovery source).
GET /api/v1/devices/{id}/certificates
List TLS certificate chains collected from each TLS port on the device, grouped by port. Collected by the v2 scanner from TLS-wrapped services (HTTPS, LDAPS, SMTPS, IMAPS, POP3S, FTPS, IRCS, TelnetS); one row per certificate in each port chain (cert_index 0 = leaf/server cert, 1..N = issuing authorities). The chain for a port is replaced in its entirety on each scan. Retained per retention.host_tls_certs_days (default 30 days).
Authenticated · CapDeviceRead (read-only)
Response:
{
"certificates": [
{
"port": 990,
"tls_version": "TLS 1.2",
"cipher_suite": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"trusted": false,
"error": "",
"updated_at": "2026-07-17T23:38:33Z",
"leaf": {
"cert_index": 0,
"subject_cn": "device.example.com",
"subject_org": "Example Org",
"subject": "CN=device.example.com,O=Example Org",
"issuer_cn": "Example CA",
"issuer_org": "Example CA Ltd",
"issuer": "CN=Example CA,O=Example CA Ltd,C=US",
"san_dns": "device.example.com, alt.example.com",
"san_ip": "192.168.1.112",
"san_email": "",
"serial": "665071982890971409216315924781532514095376553279",
"not_before": "2023-10-29T02:38:14Z",
"not_after": "2033-10-26T02:38:14Z",
"sig_algorithm": "SHA256-RSA",
"key_algorithm": "RSA",
"key_bits": 2048,
"is_ca": false,
"self_signed": false,
"fingerprint_sha256": "B8A72EE7DF38217D2C037C8927E687921FD8D31B9A0AF2E4E22779B60671F278",
"pem": "-----BEGIN CERTIFICATE-----\nMIIC4zCCAcsCFHR+...\n-----END CERTIFICATE-----\n"
},
"chain": [
{ "cert_index": 0, "subject_cn": "device.example.com", "...": "..." },
{ "cert_index": 1, "subject_cn": "Example CA", "is_ca": true, "...": "..." }
]
}
],
"total": 1
}
Field descriptions:
-
tls_version/cipher_suite/trustedare handshake metadata, identical on every entry within the same port chain (describing the same handshake). -
leafischain[0], exposed separately for at-a-glance rendering; omitted whenerroris non-empty. -
erroris non-empty when the TLS handshake fails (e.g.not TLS,handshake failure). These rows are still returned so the UI can show "this port was attempted" rather than silently omitting it. In this caseleafandchainare empty. -
trustedis a best-effort determination (one validation handshake against the system root cert pool), used for UI badge only, it does not affect collection (self-signed certs are always collected). -
When a device has no recorded TLS ports, an empty
certificatesarray is returned with HTTP 200, render an empty state, not 404.
Device Config History
Device running configuration history (Oxidized/RANCID style), written by the background config-backup service (scanner.config_backup.enabled); endpoints are read-only. The list omits config_text; details and diffs load on demand.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/devices/{id}/configs | GET | Authenticated · CapConfigRead | List device config history (excludes config_text) |
| /api/v1/devices/{id}/configs/diff | GET | Authenticated · CapConfigRead | Diff two config versions (required query params a, b = config IDs), return the diff |
| /api/v1/devices/{id}/configs/{configId} | GET | Authenticated · CapConfigRead | Get a single config version (includes config_text) |
Networks
Network registry: identifies networks in multi-subnet/multi-instance deployments (source of network_id tagging and filtering). Read (CapNetworkRead) available to any logged-in user; write (CapNetworkManage) admin only.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/networks | GET | Authenticated · CapNetworkRead | List networks |
| /api/v1/networks | POST | Admin · CapNetworkManage | Create a network (request body includes name, cidr, site) |
| /api/v1/networks/{id} | PUT | Admin · CapNetworkManage | Update a network |
| /api/v1/networks/{id} | DELETE | Admin · CapNetworkManage | Delete a network |
This instance's own network is auto-upserted into the registry at startup from configuration network.name / network.cidr / network.site.
Observed subnets are exposed read-only (#503):
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/subnets | GET | Authenticated · CapNetworkRead | Observed subnets (CIDR, gateway, VLAN linkage, first/last seen); optional ?network_id= filter; scoped to granted networks for closed-mode users |
Scanner
The network scanner uses the v2 plugin engine (probe → classify → handler → persist), detailed in Architecture → Network Scanner and Fingerprint Rule Specification. Scanner-related endpoints are gated by capability tier: read (CapDiscoveryRead) available to any logged-in user; trigger and task management (CapScanTrigger / CapScanManage) operator and above; add-devices requires CapDeviceWrite. In closed mode, non-admins can only see tasks/runs/results within granted networks; unauthorized details return 404.
Auth & Scan Sequence
sequenceDiagram
participant C as Client
participant A as API
participant E as Scanner
participant T as Target Host
participant DB as SQLite
C->>A: POST /auth/login (JWT cookie)
C->>A: POST /scanner/scan
A->>E: Orchestrate probes
E->>T: Multi-protocol probes
E->>A: Evidence + identification
A->>DB: Single-writer persistence
A-->>C: Results
POST /api/v1/scanner/scan
Run a synchronous scan against targets (single IP, CIDR, range, comma list).
Authenticated · CapScanTrigger · Scan rate limit (default 10/min per IP)
Request Body:
{ "targets": "192.168.1.0/24", "community": "public", "timeout": 2 }
-
targets(required): IP / CIDR /a.b.c.d-erange / comma list -
community(default "public"): SNMP community -
timeout(default 2): Per-host ICMP timeout (seconds) -
credential_id(optional): Bind an SNMP credential (default 0 = none)
Response: ScanResponse { hosts: [ScanHost], total, alive, duration_ms }, each ScanHost containing ip, alive, rtt_ms, snmp_* variables, and inferred_type / inferred_brand (e.g. camera, server, pc).
Persistence: Alive hosts are persisted through the device bridge (ApplyReport) into the devices table, device upsert, heartbeat-config seeding for new devices, change events, the same single-writer path as async tasks. Sync scans do not write raw scan_results / scan_task_runs rows (that is the async-task path).
Limits: Returns 413 for targets >1024 IPs (use the async task API below). Returns 504 if the server write_timeout triggers mid-scan (config drift fallback).
POST /api/v1/scanner/add-devices
Manually add devices from scan results. Each entry goes through the device bridge upsert (creates a new devices row + seeds heartbeat config for new devices).
Authenticated · CapDeviceWrite
Request Body:
{ "devices": [ { "ip": "192.168.1.1", "name": "Gateway", "type": "other", "brand": "...", "ports": [...], "services": [...] } ] }
Response: { added: int, errors: [string] }. Returns 422 when every item fails to persist (added=0, errors carries per-item reasons), the request was valid but the operation could not be applied.
Scanner Task API (async, for large ranges)
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/scanner/tasks | POST | CapScanManage | Create a cron-driven scan task (includes targets, cron expression, timeout, concurrent hosts and optional SNMP credential ID) |
| /api/v1/scanner/tasks | GET | CapDiscoveryRead | List tasks (paginated) |
| /api/v1/scanner/tasks/{id} | GET | CapDiscoveryRead | Task details |
| /api/v1/scanner/tasks/{id} | PUT | CapScanManage | Update a task |
| /api/v1/scanner/tasks/{id} | DELETE | CapScanManage | Delete a task |
| /api/v1/scanner/tasks/{id}/trigger | POST | CapScanTrigger · Scan Rate Limit | Trigger a task asynchronously (returns 202 with synthetic "triggered" status; the real run row is created when the scan starts) |
| /api/v1/scanner/tasks/{id}/cancel | POST | CapScanTrigger | Cancel a running scan (returns 409 if not running) |
| /api/v1/scanner/tasks/{id}/runs | GET | CapDiscoveryRead | Run history |
| /api/v1/scanner/tasks/{id}/results | GET | CapDiscoveryRead | Per-host results for the task |
Agent-managed networks: Agent-managed networks: a task whose targets resolve into an agent-bound network's CIDR dispatches a scan command to that agent on each cron tick (no local scan); dispatch failures appear as failed runs with the reason. See Distributed → Scheduled scans for agent-managed networks.
Task creation (POST /scanner/tasks) validates: name and targets are required; targets are capped at 4096 IPs; cron_expr is required and must be a valid cron expression; timeout must be 1–600 seconds; concurrent_hosts must be 1–200; pipeline_config must pass validation (port lists etc.). Validation failures return 400.
Scan Results API
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/scanner/results | GET | CapDiscoveryRead | Browse results (task_id, ip, alive (1/0), sort, order, limit, offset) |
| /api/v1/scanner/results/{id} | GET | CapDiscoveryRead | Single result |
| /api/v1/scanner/results/export | GET | CapDiscoveryRead | CSV export (task_id) |
| /api/v1/scanner/results | DELETE | CapScanManage | Batch delete by date (before_date, RFC3339) |
| /api/v1/scanner/runs | GET | CapDiscoveryRead | Browse runs (task_id) |
| /api/v1/scanner/runs/{id} | GET | CapDiscoveryRead | Single run |
Credentials
SNMP and SSH credential management for scanning. Both credential types are stored as AES-GCM encrypted ciphertext (security.master_key); list and detail responses are masked projections that do not include the key material. All endpoints are Admin only (CapCredManage).
SNMP Credentials
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/snmp-credentials | POST | Admin · CapCredManage | Create credential (v1/v2c community or v3 USM auth/priv) |
| /api/v1/snmp-credentials | GET | Admin · CapCredManage | List credentials (masked projection) |
| /api/v1/snmp-credentials/{id} | GET | Admin · CapCredManage | Get a single credential (masked projection) |
| /api/v1/snmp-credentials/{id} | PUT | Admin · CapCredManage | Update a credential |
| /api/v1/snmp-credentials/{id} | DELETE | Admin · CapCredManage | Delete a credential |
SSH Credentials
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/ssh-credentials | POST | Admin · CapCredManage | Create credential |
| /api/v1/ssh-credentials | GET | Admin · CapCredManage | List credentials (masked projection) |
| /api/v1/ssh-credentials/{id} | GET | Admin · CapCredManage | Get a single credential (masked projection) |
| /api/v1/ssh-credentials/{id} | PUT | Admin · CapCredManage | Update a credential |
| /api/v1/ssh-credentials/{id} | DELETE | Admin · CapCredManage | Delete credential |
SSH credentials are used by device config backup probes (see Device Config History).
Agents & Command Channel
Discovery agent management and command dispatch channel in distributed deployments. Token management and command management endpoints require Admin (CapAgentManage); agent data upload and command pull use Agent Token (RequireAgentToken) authentication, tokens are bound to agent_id + network_id, every reported device is tagged with that network, and multi-subnet data does not collide.
The fingerprint distribution endpoint (GET /api/v1/agents/fingerprints) is the fleet's no-recompile corpus-update channel: the served corpus is the center's active one (scanner.fingerprint_path dir when configured, else the embedded corpus), the revision is a pure content hash, and the envelope is a deterministic tar.gz of the *.yaml rule files. Agents validate the envelope with the rule engine's own loader before swapping it in, so a broken corpus never displaces a working one.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/agents/tokens | POST | Admin · CapAgentManage | Create agent token (request binds agent_id and network_id) |
| /api/v1/agents/tokens | GET | Admin · CapAgentManage | List agent tokens |
| /api/v1/agents/tokens/{id}/revoke | POST | Admin · CapAgentManage | Revoke an agent token |
| /api/v1/agents/tokens/{id} | DELETE | Admin · CapAgentManage | Delete an agent token |
| /api/v1/agents/report | POST | Agent Token | Agent uploads scan results (machine-to-machine; every device is tagged with the reporting network) |
| /api/v1/agents/commands | GET | Agent Token | Agent pulls pending commands (pull model) |
| /api/v1/agents/commands/{id}/ack | POST | Agent Token | Acknowledge receipt of a command |
| /api/v1/agents/commands/{id}/complete | POST | Agent Token | Report command execution result |
| /api/v1/agents/fingerprints | GET | Agent Token | Fingerprint corpus distribution: poll with ?rev=<applied>; 204 = current, 200 = deterministic tar.gz envelope + X-Fingerprint-Rev header |
Fingerprint corpus management (admin)
Settings → Fingerprints backs onto /api/v1/fingerprints (Admin, fingerprint:manage): GET the corpus status (source = dir/managed/embedded, content revision, rule count, file list, rollback availability), PUT an upload (multipart: a tar.gz/zip envelope replaces the corpus, a single .yaml replaces just that file — everything passes the rule engine's own loader before activation, a rejected corpus is a 400 carrying the engine error), POST /rollback to the predecessor, GET /upstream + POST /upstream/apply for online updates against the configured scanner.fingerprint_upstream.url manifest (check shows the version + added/removed rule diff, apply downloads + validates + activates), GET /agents for the fleet's corpus-adoption view (each agent reports the revision it runs), and GET /files/{name} for a read-only YAML preview. Every activation hot-reloads the engine (no center restart) and moves the distribution revision, so sync-enabled agents converge on their next poll. All mutations are audit-logged (fingerprint.upload / fingerprint.rollback / fingerprint.upstream_apply).
| /api/v1/agents/{agentId}/commands | POST | Admin · CapAgentManage | Create a command for a specific agent |
| /api/v1/agents/commands/all | GET | Admin · CapAgentManage | View all agent commands |
Agent token authentication and user JWT are two independent authentication systems:
/agents/reportand/agents/commands(pull/ack/complete) are under the/api/v1/agentsgroup and useRequireAgentToken; command management and token management use admin JWT.
L2 neighbors on agent reports (since 2026-10): each host in the
POST /agents/reportpayload may carry aneighborsarray — L2 adjacency edges the agent's LLDP / CDP / Bridge-MIB / Q-BRIDGE-MIB / STP probes observed (neighbor_macandprotocolrequired; optionallocal_port/remote_port/vlan_tag/sys_name/sys_desc/source). The center rebuilds each edge intoneighborevidence and records it indevice_neighborsthrough the same pipeline a local scan uses, so the topology view treats local and agent-reported edges identically. Rows missingneighbor_macorprotocolare dropped. The same flat-array channel carries the newer port-level facts:interfaces(IF-MIB + ipAddrTable census rows,if_indexis the merge key →device_interfaces, #529) androutes(ipRouteTable rows,dest+next_hoprequired → route-table topology edges, #528).
Changes & Discovery
Change event stream and passive discovery status.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/changes | GET | Authenticated · CapChangesRead | Change event list (device_added / device_changed / device_lost; filterable by network_id / change_type / entity_type) |
| /api/v1/changes/watch | GET | Authenticated · CapChangesRead | Real-time change push (SSE) |
| /api/v1/discovery/status | GET | Authenticated · CapDiscoveryRead | Passive discovery runtime status (event count, dedup hits, identification triggers, recorded device count, active source list; enabled=false when service is disabled) |
Change events are written to the change_log table by the change detection engine; /changes/watch pushes in real time via an in-process watcher. The notification rule engine subscribes to the same event source (see Notifications).
Topology
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/topology | GET | Authenticated · CapTopologyRead | Full network topology: all devices (nodes) + all neighbor edges |
Documents
Document management with URL fetching and file upload capabilities.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/documents | GET | Authenticated · CapDocumentRead | List documents |
| /api/v1/documents/{id} | GET | Authenticated · CapDocumentRead | Get document details |
| /api/v1/documents/{id}/download | GET | Authenticated · CapDocumentRead | Download document file |
| /api/v1/documents | POST | Authenticated · CapDocumentWrite (operator+) | Create a URL document |
| /api/v1/documents/upload | POST | Authenticated · CapDocumentWrite (operator+) | Upload a file document (multipart) |
| /api/v1/documents/{id} | PUT | Authenticated · CapDocumentWrite (operator+) | Update a document |
| /api/v1/documents/{id} | DELETE | Authenticated · CapDocumentWrite (operator+) | Delete a document |
GET /api/v1/documents
List documents.
Authenticated · CapDocumentRead
Query Parameters:
-
search: Fuzzy search over title/description -
limit: Number of results (default: 20, max: 100) -
offset: Pagination offset
Response:
{
"documents": [
{
"id": 1,
"title": "Server Manual",
"type": "file",
"url": "",
"file_path": "./data/uploads/server-manual.pdf",
"file_size": 2048000,
"mime_type": "application/pdf",
"description": "Server administration manual",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
GET /api/v1/documents/{id}
Get document details.
Authenticated · CapDocumentRead
Response: Same as GET /api/v1/documents, but a single document object.
GET /api/v1/documents/{id}/download
Download document file.
Authenticated · CapDocumentRead
Response: File download with appropriate content-type header.
POST /api/v1/documents
Create a URL document.
Authenticated · CapDocumentWrite (operator and above)
Request:
{
"title": "string",
"type": "url",
"url": "https://example.com/document",
"description": "string"
}
Response: 201 Created with DocumentResponse.
POST /api/v1/documents/upload
Upload a file document (multipart form).
Authenticated · CapDocumentWrite (operator and above)
Form Parameters:
-
file: File to upload (default max 10 MiB, configurable viastorage.max_file_size; a reverse proxy'sclient_max_body_sizeis a separate layer) -
title: Document title -
description: Document description
Response: 201 Created with DocumentResponse.
PUT /api/v1/documents/{id}
Update a document.
Authenticated · CapDocumentWrite (operator and above)
Request:
{
"title": "string",
"url": "string",
"description": "string"
}
Response: 200 OK with updated DocumentResponse.
DELETE /api/v1/documents/{id}
Delete a document.
Authenticated · CapDocumentWrite (operator and above)
Response: 200 OK with {"message": "document deleted"}
Device-Document Links
Association management between devices and documents.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/devices/{id}/documents | GET | Authenticated · CapDocumentRead | Get documents associated with a device |
| /api/v1/devices/{id}/documents | POST | Authenticated · CapDocumentWrite (operator+) | Associate a document with a device |
| /api/v1/devices/{id}/documents/{docId} | DELETE | Authenticated · CapDocumentWrite (operator+) | Remove association between device and document |
| /api/v1/documents/{id}/devices | GET | Authenticated · CapDocumentRead | Get devices associated with a document |
GET /api/v1/devices/{id}/documents
Get documents associated with a device.
Authenticated · CapDocumentRead
Response:
{
"documents": [
{
"id": 1,
"title": "Server Manual",
"type": "file",
"url": "",
"file_path": "./data/uploads/server-manual.pdf",
"file_size": 2048000,
"mime_type": "application/pdf",
"description": "Server administration manual",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
POST /api/v1/devices/{id}/documents
Associate a document with a device.
Authenticated · CapDocumentWrite (operator and above)
Request:
{
"document_id": 1
}
Response: 201 Created
DELETE /api/v1/devices/{id}/documents/{docId}
Remove association between device and document.
Authenticated · CapDocumentWrite (operator and above)
Response: 200 OK with {"message": "document unlinked from device"}
GET /api/v1/documents/{id}/devices
Get devices associated with a document.
Authenticated · CapDocumentRead
Response:
{
"devices": [
{
"id": 1,
"name": "Server-01",
"type": "pc",
"brand": "Dell",
"model": "PowerEdge R740",
"location": "Data Center A",
"purpose": "Web Server",
"description": "Primary web hosting server",
"status": "online",
"ip_address": "192.168.1.100",
"mac_address": "00:1A:2B:3C:4D:5E",
"serial_number": "DELL123456",
"purchase_date": "2022-01-15",
"warranty_expiry": "2025-01-15",
"tags": "web,primary",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
Heartbeat
Device heartbeat configuration and monitoring. Read (CapHeartbeatRead) available to any logged-in user; write (CapHeartbeatManage) operator and above (operator+, not admin-only).
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/devices/{id}/heartbeat-configs | GET | Authenticated · CapHeartbeatRead | Get device heartbeat configuration |
| /api/v1/devices/{id}/heartbeat-configs | POST | Operator+ · CapHeartbeatManage | Create device heartbeat configuration |
| /api/v1/heartbeat-configs/{id} | PUT | Operator+ · CapHeartbeatManage | Update heartbeat configuration |
| /api/v1/heartbeat-configs/{id} | DELETE | Operator+ · CapHeartbeatManage | Delete heartbeat configuration |
| /api/v1/devices/{id}/heartbeat-results | GET | Authenticated · CapHeartbeatRead | Device heartbeat results (paging default 50/max 500, start_date/end_date filters) |
| /api/v1/devices/{id}/heartbeat-results/export | GET | Authenticated · CapHeartbeatRead | Export heartbeat results (CSV) |
| /api/v1/devices/{id}/heartbeat-history | GET | Authenticated · CapHeartbeatRead | Device heartbeat history (required from/to, RFC3339, to > from, range ≤ 90 days) |
| /api/v1/devices/{id}/heartbeat-stats | GET | Authenticated · CapHeartbeatRead | Device heartbeat statistics (required from/to, RFC3339, to > from, range ≤ 90 days) |
GET /api/v1/devices/{id}/heartbeat-configs
Get device heartbeat configuration.
Authenticated · CapHeartbeatRead
Response:
{
"configs": [
{
"id": 1,
"device_id": 1,
"method": "icmp",
"target": "192.168.1.100",
"interval_seconds": 30,
"timeout_seconds": 5,
"snmp_community": "public",
"snmp_oid": "1.3.6.1.2.1.1.3.0",
"enabled": 1,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
POST /api/v1/devices/{id}/heartbeat-configs
Create device heartbeat configuration.
Operator+ · CapHeartbeatManage
Request:
{
"method": "icmp",
"target": "192.168.1.100",
"interval_seconds": 30,
"timeout_seconds": 5,
"snmp_community": "public",
"snmp_oid": "1.3.6.1.2.1.1.3.0",
"enabled": 1
}
-
method(required):icmp|http|tcp|snmp -
target(required): probe target -
interval_seconds(optional, default 30): probe interval (seconds) -
timeout_seconds(optional, default 5): timeout (seconds) -
snmp_community(optional, default "public"): SNMP community -
snmp_oid(optional, default sysUpTime OID): SNMP probe OID -
enabled(optional, default 1): whether enabled
Response: 201 Created with HeartbeatConfigResponse.
PUT /api/v1/heartbeat-configs/{id}
Update heartbeat configuration (partial update using pointer fields, same field names as the create request).
Operator+ · CapHeartbeatManage
Request:
{
"method": "icmp",
"target": "192.168.1.100",
"interval_seconds": 30,
"timeout_seconds": 5,
"snmp_community": "public",
"snmp_oid": "1.3.6.1.2.1.1.3.0",
"enabled": 1
}
Response: 200 OK with updated HeartbeatConfigResponse.
DELETE /api/v1/heartbeat-configs/{id}
Delete heartbeat configuration.
Operator+ · CapHeartbeatManage
Response: 200 OK with {"message": "heartbeat config deleted"}
GET /api/v1/devices/{id}/heartbeat-results
Get device heartbeat results.
Authenticated · CapHeartbeatRead
Query Parameters:
-
limit: Number of results (default: 50, max: 500) -
offset: Pagination offset -
start_date/end_date: Filter by check time (RFC3339)
Response:
{
"results": [
{
"id": 1,
"device_id": 1,
"config_id": 1,
"status": "success",
"latency_ms": 12,
"error_message": "",
"checked_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
status is one of success / fail / timeout; checked_at is an RFC3339 string.
Synthetic Probing
Periodic probing of EXPLICIT user-configured endpoints (blackbox_exporter-style), typically external/internet resources. Five modules: http / tls / tcp / icmp / dns (bare-domain DNS resolution with optional pinned resolver and expected-IP assertions). The tls module, and https-flavored http targets, collect the full certificate chain (reusing the scanner's internal cert inventory for external hosts; results carry a trust verdict and TLS version). Targets may carry a per-module options object (#605) — http method/expected statuses/body keyword/ignore-TLS-errors, dns record/resolver/expected IPs, tcp send/expect, icmp burst_count/burst_interval_ms — and bind to a discovered device via device_id (#606); every response carries source (manual / auto / system). Options deliberately hold no credentials or auth headers: they are plaintext in the DB and ride the secret-free agent command channel. Reads (CapProbeRead) are available to any logged-in user; writes (CapProbeManage) require operator and above. Field-level documentation lives in openapi.yaml (ProbeTarget / ProbeOptions / ProbeQualityReport).
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/probe-targets/ | GET | Auth · CapProbeRead | List targets (limit/offset/search, optional device_id filter #606) |
| /api/v1/probe-targets/ | POST | Operator+ · CapProbeManage | Create a probe target |
| /api/v1/probe-targets/{id} | GET | Auth · CapProbeRead | Get one target |
| /api/v1/probe-targets/{id} | PUT | Operator+ · CapProbeManage | Update (partial; nil fields unchanged; device_id: 0 clears the binding) |
| /api/v1/probe-targets/{id} | DELETE | Operator+ · CapProbeManage | Delete target (with its result history and stored certificate chain) |
| /api/v1/probe-targets/{id}/trigger | POST | Operator+ · CapProbeManage | Probe now (synchronous, returns the recorded result) |
| /api/v1/probe-targets/{id}/results | GET | Auth · CapProbeRead | Result history (limit/offset, newest first; optional vantage filter, center or agent:{agent_id}, empty = all vantages) |
| /api/v1/probe-targets/{id}/certificates | GET | Auth · CapProbeRead | Current certificate chain (same shape as the device endpoint) |
| /api/v1/probe-targets/{id}/phases | GET | Auth · CapProbeRead | Per-stage timing history (#717), newest first (limit, default 200/max 500) |
| /api/v1/probe-targets/autogen-sweep | POST | Operator+ · CapProbeManage | Run one autogen reconcile sweep now (reads the effective overlay / config policy) |
| /api/v1/probe-quality | GET | Auth · CapProbeRead | Quality analysis (#613): per-category, per-vantage verdicts — lan/external simple health + the egress matrix chain (optional window minutes) |
| /api/v1/probe-quality/history | GET | Auth · CapProbeRead | Bucketed quality trend — the same verdict chain replayed per hour (days=7) or day (days=30) bucket |
| /api/v1/probe-quality/episodes | GET | Auth · CapProbeRead | Degradation episodes (#720): relative-baseline drops with cross-evidence and attribution (days, active=1 = unresolved only) |
| /api/v1/probe-matrix | GET | Auth · CapProbeRead | Site-to-site N×N matrix (#748): per-leg RTT/loss/jitter over the mesh-* autogen targets (optional window minutes) |
| /api/v1/probe-egress | GET | Auth · CapProbeRead | Current egress identity per vantage (#718): latest public-IP echo round, ASN enrichment, local gateway (recording only) |
| /api/v1/probe-paths | GET | Auth · CapProbeRead | Latest traced path per target and vantage (#719): hop list, reached TTL, reply TTL |
| /api/v1/settings/probes | GET | Admin · CapUserManage | Effective probe policy switches (quality matrix + autogen; DB overlay > YAML) |
| /api/v1/settings/probes | PUT | Admin · CapUserManage | Update probe policy switches (matrix reseeds / autogen sweeps immediately) |
| /api/v1/settings/probes/stun-servers | GET | Admin · CapUserManage | STUN server list for the gateway profile (#750); ?defaults=1 returns the shipped defaults |
| /api/v1/settings/probes/stun-servers | PUT | Admin · CapUserManage | Replace the whole list (builtins may be disabled but not dropped; max 8) |
| /api/v1/settings/probes/stun-servers/test | POST | Admin · CapUserManage | Send one STUN Binding Request to test an endpoint (mapped address + RTT, never persists) |
| /api/v1/devices/{id}/diagnosis | GET | Auth · CapDeviceRead | Network-anomaly diagnosis of a device (#761): address timeline with liveness, classified findings with evidence, same-hostname siblings |
POST /api/v1/probe-targets/
Create a probe target.
Operator+ · CapProbeManage
Request:
{
"name": "github-tls",
"module": "tls",
"target": "github.com:443",
"interval_seconds": 60,
"timeout_seconds": 10,
"notes": "",
"enabled": true,
"vantage": "center"
}
-
name(required, globally unique): target name (also the Prometheus metric label) -
module(required):http|tls|tcp|icmp|dns -
target(required, module-validated):httpneeds a full http(s) URL;tls/tcpneed host:port (port 1–65535);icmpneeds a bare host or IP;dnsneeds a bare domain (no port, no path — the resolver is an option, not part of the target) -
interval_seconds(optional, default 60): probe interval, 10–86400 seconds -
timeout_seconds(optional, default 10): per-probe timeout, 1–60 seconds, must be smaller than the interval -
notes(optional, ≤500 chars),enabled(optional, default true) -
vantage(optional, defaultcenter): execution plan,center(this instance probes),agent:{agent_id}(that agent executes over the distributed command channel; the center refuses local execution, so manual trigger returns 409), orall(center + every registered agent; each track's rows are stampedcenter/agent:{id}, see Distributed) -
options(optional, per-module, #605): http —method(GET/HEAD),expected_status(exact allowed codes, e.g.[200,204]; empty = status < 400),keyword+keyword_mode(contains/not_contains/regex),ignore_tls_errors(default false = verify TLS); dns —record(A/AAAA/CNAME/TXT),resolver(host[:port], empty = system resolver),expected_ips(A/AAAA answers must intersect, ≤8 entries); tcp —send(payload written after connect),expect+expect_mode(contains/regex) banner match. icmp —burst_count(1–20 echoes per round; 0/1 = legacy single ping) andburst_interval_ms(10–1000 between echoes, 0 = 20 ms prober default, requiresburst_count), whose burst round reportsloss_pct/jitter_msas first-class metrics (#744); tls takes no options. Fields foreign to the module are rejected, and no credentials/auth headers exist by design (options are plaintext in the DB and ride the secret-free agent command channel verbatim). -
device_id(optional, #606): bind the target to a discovered asset;GET /probe-targets?device_id=filters by it, and device deletion unbinds (auto-generated targets are disabled, manual ones keep running).
Response: 201 Created with ProbeTargetResponse (including the denormalized last_run_at/last_status/last_latency_ms/last_error, which mirror the CENTER track only; plus vantage_latest, the newest result row of every vantage track with agent tracks included, omitted when there is no history yet; plus options, device_id (omitted when unbound), and source — manual / auto (autogen, #606) / system (egress-quality matrix, #608)).
POST /api/v1/probe-targets/{id}/trigger
Run one probe immediately (mutually exclusive with the scheduler via an in-flight guard; bounded by the target's timeout_seconds).
Operator+ · CapProbeManage
Response: the just-recorded result (ProbeResultResponse):
{
"target_id": 1,
"status": "success",
"latency_ms": 75.09,
"status_code": 0,
"error_message": "",
"tls_version": "TLS 1.2",
"cert_not_after": "2027-01-24T02:32:55Z",
"cert_trusted": true,
"checked_at": "2026-08-19T06:30:22Z"
}
status is success / fail / timeout (a probe error carrying timeout markers is classified as timeout); status_code is non-zero only for the http module; the certificate fields are present only when a cert was collected (cert_trusted of null means none this run).
GET /api/v1/probe-targets/{id}/certificates
The target's current certificate chain (leaf + intermediates/root, with SAN/serial/fingerprint/PEM/handshake metadata). A transient collection failure keeps the last known-good chain; no certificates at all returns an empty array (200). The certificates[] response is structurally identical to GET /api/v1/devices/{id}/certificates (one single-port entry per target).
Related metrics: mibee_probe_up{name,module}, mibee_probe_duration_seconds, mibee_probe_cert_expiry_timestamp_seconds, mibee_probe_checks_total{status,module} (see Metrics & Service Discovery).
GET /api/v1/probe-quality
Network egress quality (#608), read-time analysis over the probe.quality matrix's recent results. Optional window query parameter overrides the lookback (minutes, default probe.quality.window_minutes).
Authenticated · CapProbeRead
Response shape (details in openapi.yaml, ProbeQualityReport): window_minutes plus categories[] — the management categories (#613): lan (device-bound targets) and external (manual unbound business targets) each carry simple window-health verdicts (ok / degraded / insufficient; mean ok-rate vs the threshold plus per-module p50 budgets), while quality nests the egress matrix's groups[], one per configured group — the reserved domestic group is role: primary (its verdict IS the network's verdict), every other group (default international) is role: reference (displayed separately; cross-border variance is its own signal, not an egress fault). Each group carries vantages[] (vantage, network_name, verdict, score 0–100, reasons[] stable codes such as egress_down.all_paths_failing / dns_fault.direct_ok_name_resolution_dead / upstream_resolver.failing:<target> / ok_rate_low / latency_high / insufficient_data) and targets[] with per-vantage window stats (ok_rate, p50_ms, samples) plus a cross_vantage isolation verdict (ok / target_down / mixed / no_data — failing EVERYWHERE blames the target and excludes it from network verdicts; meaningful only with more than one reporting vantage). The verdict chain is deterministic: egress_down > dns_fault > upstream_resolver > degraded > ok. The same verdicts/scores are exported as mibee_probe_egress_verdict{vantage,category,group,verdict} / mibee_probe_quality_score{vantage,category} gauges — metrics only, no notification wiring by design.
Dashboard
Prometheus data source dashboard configuration and query passthrough. Read (CapDashboardRead, network scope filtering) available to any logged-in user; configuration management (CapDashboardManage) admin only.
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/dashboard/configs | GET | Authenticated · CapDashboardRead | List dashboard panel configurations |
| /api/v1/dashboard/configs | POST | Admin · CapDashboardManage | Create a panel configuration |
| /api/v1/dashboard/configs/{id} | PUT | Admin · CapDashboardManage | Update a panel configuration |
| /api/v1/dashboard/configs/{id} | DELETE | Admin · CapDashboardManage | Delete a panel configuration |
| /api/v1/dashboard/overview | GET | Authenticated · CapDashboardRead | Overview statistics (device/system/network counts) |
| /api/v1/dashboard/query | GET | Authenticated · CapDashboardRead | Prometheus instant query passthrough |
| /api/v1/dashboard/query_range | GET | Authenticated · CapDashboardRead | Prometheus range query passthrough |
GET /api/v1/probe-quality/history
Bucketed egress-quality trend: the SAME deterministic verdict chain as /api/v1/probe-quality, replayed per time bucket over the retention horizon. Aggregation happens SQL-side (one row per target × vantage × bucket), so a 30-day month is a few hundred bucket rows, not ~800k raw results; the one approximation is latency — per-bucket budgets judge the bucket's mean success latency instead of an exact p50 (the structural verdicts egress_down / dns_fault / upstream_resolver are ok-rate driven and stay exact). days accepts 7 (hourly buckets) or 30 (daily buckets); raw probe results are retained 30 days by default (retention.probe_results_days), so a 30-day chart starts wherever the data starts. Cross-vantage target-down isolation applies per bucket, same as the live window.
Authenticated · CapProbeRead
Response shape (ProbeQualityHistoryReport): days, bucket (hour | day) and groups[] mirroring the report's config groups (role: primary / reference), each with series[] per vantage (vantage, network_name) whose points[] carry t (bucket start, UTC), ok_rate (mean over the bucket's evaluated legs), avg_ms (success-latency mean weighted by successful samples), samples, score and verdict. Buckets with no data are omitted — gaps in the series.
GET /api/v1/dashboard/configs
List dashboard panel configurations.
Authenticated · CapDashboardRead
Response:
{
"configs": [
{
"id": 1,
"name": "CPU Usage",
"type": "line",
"data_source": "prometheus",
"query": "100 - (avg by (instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
"refresh_interval": 30,
"position": "{\"col\":1,\"row\":1}",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"total": 1
}
position is a JSON string (panel layout coordinates), not an object.
POST /api/v1/dashboard/configs
Create a dashboard panel configuration.
Admin Required · CapDashboardManage
Request:
{
"name": "CPU Usage",
"type": "line",
"data_source": "prometheus",
"query": "100 - (avg by (instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
"refresh_interval": 30,
"position": "{\"col\":1,\"row\":1}"
}
-
name(required): panel name -
type(required):gauge|line|bar|pie -
data_source(optional, default "prometheus"): data source type -
query(optional): query expression -
refresh_interval(optional, default 30): refresh interval (seconds) -
position(optional, default "{}"): layout coordinates (JSON string)
Response: 201 Created with DashboardConfigResponse.
GET /api/v1/dashboard/query
Passthrough instant query to the configured Prometheus data source. Equivalent to Prometheus HTTP API GET /api/v1/query, but only query and time are forwarded (other parameters are not).
Authenticated · CapDashboardRead
Query Parameters:
-
query(required): PromQL expression -
time(optional): Evaluation timestamp (RFC3339 or Unix seconds; defaults to server current time)
Response: Prometheus query response envelope (status / data).
GET /api/v1/dashboard/query_range
Passthrough range query to the configured Prometheus data source. Equivalent to Prometheus HTTP API GET /api/v1/query_range, but only query, start, end, and step are forwarded (other parameters are not).
Authenticated · CapDashboardRead
Query Parameters:
-
query(required): PromQL expression -
start/end(required): Range start/end timestamps (RFC3339 or Unix seconds) -
step(required): Step size (duration format, e.g.15s)
Response: Prometheus query_range response envelope (status / data, with resultType: matrix).
Notifications
Alert notification channel and rule management. Rules are gated by capability matrix (CapNotificationManage), admin by default; channels use the same capability, PATCH for enable/disable. Log endpoints are readable by any logged-in user.
Notification Channels
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/notification/channels | POST | Admin · CapNotificationManage | Create a channel |
| /api/v1/notification/channels | GET | Admin · CapNotificationManage | List channels |
| /api/v1/notification/channels/{id} | GET | Admin · CapNotificationManage | Channel details |
| /api/v1/notification/channels/{id} | PUT | Admin · CapNotificationManage | Update a channel |
| /api/v1/notification/channels/{id} | PATCH | Admin · CapNotificationManage | Enable/disable a channel |
| /api/v1/notification/channels/{id} | DELETE | Admin · CapNotificationManage | Delete a channel |
| /api/v1/notification/channels/{id}/test | POST | Admin · CapNotificationManage | Send a test notification |
Notification Rules
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/notification/rules | POST | Admin · CapNotificationManage | Create a rule |
| /api/v1/notification/rules | GET | Admin · CapNotificationManage | List rules |
| /api/v1/notification/rules/{id} | GET | Admin · CapNotificationManage | Rule details |
| /api/v1/notification/rules/{id} | PUT | Admin · CapNotificationManage | Update a rule |
| /api/v1/notification/rules/{id} | PATCH | Admin · CapNotificationManage | Enable/disable a rule |
| /api/v1/notification/rules/{id} | DELETE | Admin · CapNotificationManage | Delete a rule |
event_type values: device change events (device_lost, device_recovered, device_added, device_changed, speaks_with_new, listen_port_added; scoped all/network/device, entity_type device), probe liveness events (probe_failed, probe_recovered — a track failing 3 consecutive probe runs declares probe_failed, the first success after that emits probe_recovered; per (target, vantage) track, scope all only, entity_type probe_target), and agent fleet liveness events (agent_offline, agent_recovered — an agent whose last_report_at is stale past 10 minutes declares agent_offline, its next report emits agent_recovered; scope all only, entity_type agent).
Notification Logs
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/notification/logs | GET | Authenticated | Notification send logs (paginated) |
| /api/v1/notification/logs/read | POST | Authenticated | Mark notification logs as read |
Audit Logs
Audit logs track user actions (login/logout, device CRUD, configuration changes, etc.). Read-only endpoints readable by any logged-in user (CapAuditRead).
| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| /api/v1/audit-logs | GET | Authenticated · CapAuditRead | Query audit logs (filter by time/user/action, paginated) |
| /api/v1/audit-logs/facets | GET | Authenticated · CapAuditRead | Audit log dimension aggregation (time histogram, action/user/entity counts, for filter UI) |
| /api/v1/audit-logs/export | GET | Authenticated · CapAuditRead | Export audit logs (CSV) |
Metrics & Service Discovery
The following endpoints are not under the /api/v1 prefix and require no authentication:
| Endpoint | Description |
|----------|-------------|
| GET /metrics | Prometheus metrics scrape endpoint (HTTP request counters/histograms, written by the Metrics middleware) |
| GET /sd | Prometheus HTTP SD file contents (registered device IPs and labels, for Prometheus service discovery) |
| GET /.well-known/mibee-service | Ecosystem service discovery identity (#729): {service: steward, name, ver, id} — the Scout app's scan classifier |
Pagination
List endpoints use limit and offset query parameters under the API Contract policy: absent/0 → endpoint default, malformed or negative → 400, over-max → clamped (detectable via the echoed limit). Per-endpoint defaults/maxima are tabulated in the contract section.
Responses use the { "<items>": [...], "total": <int>, "limit": <int>, "offset": <int> } envelope, where total is the filtered count and limit/offset echo the effective pagination.
Rate Limiting
| Limit | Default | Applies To |
|-------|---------|------------|
| Global Rate Limit | 600 req/min/IP | All endpoints (rate_limit.global_per_minute) |
| Login Rate Limit | 10 req/min/IP | /api/v1/auth/* (including 2FA verification, rate_limit.login_per_minute) |
| Scan Rate Limit | 10 req/min/IP | POST /scanner/scan and POST /scanner/tasks/{id}/trigger (rate_limit.scan_per_minute) |
-
Scan rate limit is enforced after capability gating, unauthorized requests (403) do not consume quota.
-
Exceeding the limit returns
429 Too Many Requests. -
Values are configurable; see Configuration Reference.
Error Codes
| Status Code | Meaning |
|-------------|---------|
| 400 | Invalid request body or query parameters |
| 401 | Unauthenticated or token invalid/expired |
| 403 | Authenticated but insufficient capabilities; in closed scope mode, out-of-scope device access also returns 403 (forbidden: device out of network scope) |
| 404 | Resource not found (in closed scope mode, unauthorized scan tasks/runs/results also return 404 to prevent existence leaking) |
| 409 | State conflict (e.g. cancelling a scan task that is not running) |
| 413 | Target scope too large (e.g. synchronous scan with >1024 IPs) |
| 422 | Valid request but the operation could not be applied (e.g. add-devices where every item fails to persist) |
| 429 | Rate limit exceeded; also returned for account lockout after 5 consecutive failed logins (30-minute lock, 429 "account is temporarily locked") |
| 500 | Internal server error |
| 502 / 504 | Upstream unreachable (e.g. Prometheus query passthrough failure / scan timeout fallback) |