Reader Heartbeat API
An active reader uses POST /api/v1/me/heartbeat to report its latest telemetry. This is separate from broker connectivity, pairing/provisioning, credential validity and scan synchronization. Follow Reader Authentication for the supported reader type; a project API key, administrator or attendee is not a reader principal.
Authenticate and report
Use the active reader's supported Sanctum authentication. The request authorizes an active AccessPointReader before field validation; another principal or inactive reader is refused with 403. The route has no project slug or reader ID parameter: the authenticated reader selects the row/cache key. A payload device_id updates descriptive device metadata, not the authenticated identity.
This synthetic payload is not sent:
{
"battery": 0.42,
"charging": false,
"network": "wifi",
"pending_scans": 2,
"model": "Documentation Test Reader",
"os": "Android 14",
"app_version": "1.0.0"
}
All fields are optional/nullable. battery is a fraction from 0 to 1, not a percentage; the health service rounds it to integer percent. charging is boolean; pending scans is a nonnegative integer. Network is trimmed/lowercased and must be one of wifi, cellular, ethernet, bluetooth, vpn, wimax, other, none or unknown. Canonical JSON examples use those lowercase values.
Identity fields device_id, model, os and app_version are strings up to 255 characters. Omitted/null identity fields retain saved values. A nonempty OS can update the saved platform from its lowercase first word. Accepted low_power_mode, online and sent_at are forward-compatible inputs ignored by the health recording path; the server clock stamps the reading.
Handle acknowledgement and freshness
Success is HTTP 204 with no JSON body. Check status without calling response.json() on that acknowledgement. The endpoint records cache telemetry and last_seen_at, and changes saved identity/platform when needed. It intentionally leaves the reader's updated_at alone and bypasses ordinary model-edit audit/observer behavior; lack of an edit timestamp change does not mean the heartbeat was lost.
Health readings replace the cached telemetry payload rather than merge each field. Omitted battery/charging/network/pending-scan values can become unknown in the new reading, while saved identity omission behaves differently. Send the current telemetry values you intend to preserve, rather than assuming a battery-only report retains all prior measurements.
Cache lifetime is configured heartbeat interval × offline-after intervals, with fallbacks 60 seconds × three. An absent/expired payload is Offline; a present payload with pending scans is Syncing, otherwise Online. Client online and sent_at cannot override that computation. A heartbeat acknowledgement is not proof queued scans reached the backend, a broker link is healthy or the physical device performed an action. Missing battery is unknown, not a measured healthy level.
The named limiter defaults to 20 per minute keyed by reader ID and resolved IP, configurable and separate from GET /me throttling. Honor 429 and avoid treating repeated telemetry writes as a general health query.
Verify and troubleshoot
In an approved test reader/client, verify fraction validation, network normalization, empty-204 handling, saved last-seen/identity and cache freshness/expiry. Compare pending-scan and broker signals separately; test inactive/wrong principals and payload identity spoofing without changing the selected authenticated row. These are real telemetry/record writes, so the documentation's schema example does not execute them.
| Symptom | Check |
|---|---|
| 401 | Reader credential validity and supported auth flow. |
| 403 before malformed-body errors | Wrong/inactive principal is rejected before validation. |
| 422 battery/network | Fraction 0–1 and supported network value, not 42 or arbitrary labels. |
| JSON parse failure after success | Expected empty 204; inspect status. |
| Telemetry disappeared | Replacement payload omissions or configured cache expiry. |
| Updated At unchanged | Heartbeat is deliberately not an ordinary model edit. |
| Online disagrees with broker/scan state | Different signals; inspect their source and observation time. |
The REST reference describes the request and empty acknowledgement. Source review at platform 90f805aab4cc0ff6a915068e88e1c495f53d04cc and structural tests do not establish deployed auth, cache/database/concurrency or actual device acceptance.