Skip to main content

Device Management (Registry)

:::info Status Implemented. Source: docs/device-management-module-architecture.md §7; fastapi-backend/api/v1/endpoints/device_registry.py, fastapi-backend/core/device_registry.py, fastapi-backend/core/device_claim.py, fastapi-backend/core/inventory_registry.py, fastapi-backend/core/device_transfer.py. :::

The device registry is the unified authorization spine for both sold device kinds (transmitter, stream player) — inventory tracking, the approval lifecycle, mosque binding moves, ownership transfer, and warranty replacement, all in one place. Concepts behind this module: Identity, Ownership, Device Authorization, Mosque Binding, Device Lifecycle.

Mounted at /api/v1/device-registry, distinct from the older /api/v1/devices and /api/v1/mosque-devices routers (kept as separate routers deliberately — sharing a path prefix would make routing depend on registration order in api/v1/api.py).

Super Admin work queue

Everything that moves lifecycle_status is Super Admin only, except the two entry points that are asymmetric by design:

MethodPathAuthPurpose
POST/device-registry/announcenone (IP rate-limited)Unprovisioned unit self-announces. Creates a PENDING row only if the serial/MAC matches a manifested inventory row; otherwise logged to unmanifested_announcements. No credentials ever returned
POST/device-registry/claimuser JWTThe buyer claims a sold unit — cross-checked against inventory (see Identity), opens ownership + assignment, releases broker credentials, stays PENDING
GET/device-registry/devicessuperadminPaginated registry, filterable by status/kind/mosque/owner/connectivity
GET/device-registry/devices/{id}superadminIdentity, bindings, config, health rollup
POST/device-registry/devices/{id}/transitions/{action}superadminThe lifecycle transition matrix, one cell per call
POST/device-registry/devices/{id}/approvesuperadminverify + activate in one transaction — the common path for an already-sold, already-bound unit
POST/device-registry/devices/{id}/transfer-ownershipsuperadminSee Ownership
POST/device-registry/devices/{id}/replacesuperadminWarranty replacement — see Ownership
GET/device-registry/devices/{id}/assignments · /audit · /eventssuperadminBinding history · audit trail · telemetry events
POST/device-registry/devices/{id}/cmdsuperadminSend a device command
GET/device-registry/announcementssuperadminThe queue of units matching no manifest
POST/device-registry/announcements/{id}/promotesuperadminExplicit, audited import of an unmanifested announcement into inventory
GET/POST/PATCH/device-registry/inventory, /inventory/{id}superadminProcurement records
POST/device-registry/inventory/importsuperadminBatch import (CSV/JSON)
POST/device-registry/inventory/{id}/transitions/{action}superadminThe inventory asset's own state matrix — see Device Lifecycle
POST/device-registry/inventory/{id}/claimsuperadminBind an inventory row to a device manually

Full request/response schemas: API Reference.

The biggest operational risk — approval-queue cutover

:::danger Rollout risk Every existing self-registered stream player (legacy user_devices receiver rows) was approved by nobody. At cutover, all of these devices enter the Super Admin approval queue and stop streaming until approved. :::

Per docs/device-management-architecture-summary.md: no authorization flip while any existing customer receiver remains unapproved — the rollout plan must gate the stream-authorization flip on this queue reaching zero, with affected devices tracked by serial number. This is the same STREAM_AUTHZ_ENFORCE flag documented operationally in Backend Deployment — that page covers the mechanical flip; this callout is the business risk driving why it isn't flipped yet.

Owner-facing (no Super Admin gate)

See Mosque Binding — owner-facing API for /my-devices/* — rebinding is deliberately not superadmin-gated.

The registry described here unifies what used to be split across mosque_devices (transmitters) and user_devices (stream players + app rows conflated together) — see Roadmap — Device Registry Unification for the migration sequencing.