Devices API
Machine integrations: device registry, device credentials, agent API (heartbeat and long-poll jobs), label printing, 3D printers synchronised from Moonraker, design file libraries with manual job logs (Cricut, embroidery) and generic jobs for Raspberry Pis.
Device credentials. Registering a device issues an authz API key owned by the device (owner kind
device, no grants), shown once. Agents call /v1/devices/agent/* with Authorization: Bearer <key>
through the gateway; the gateway rejects device keys on every other path. Keys can be rotated and are
revoked when the device is deleted. Disabled devices are rejected (403 device_disabled).
Status. online on heartbeat (or a successful Moonraker poll), offline after DEVICES_OFFLINE_AFTER
without contact, error when the agent reports it (or Klipper is in error), disabled by a manager.
Jobs. queued → delivered → running → done | failed, plus cancelled. delivered jobs not acknowledged
within DEVICES_JOB_ACK_TIMEOUT are queued again (at most DEVICES_JOB_MAX_ATTEMPTS deliveries).
Types: label (from inventory.label.print_requested, routed round robin to an online label printer of the
item's site; unassigned while none is online), generic (free-form payload, Raspberry Pis) and manual
(logged by a member, already done).
Prints (Moonraker). A lease job polls printer/objects/query and server/history/list of every enabled
3D printer every DEVICES_MOONRAKER_INTERVAL (X-Api-Key header). Prints are attributed manually to a member
and/or a project. When the printer maps a filament spool to an inventory consumable, the attribution can post
a stock out movement (reference devices:print:<id>) with the caller principal; transient failures stay
pending and are retried with the service principal (the reference is checked first: idempotent).
Files. Design libraries are files service attachments owned by atl:devices:<site>:device/<id>
(purpose design) or by a project ARN. The files service delegates write decisions on device files to
POST /internal/v1/attachments/authorize (devices.file.manage).
Authorization: devices.device.read|create|update|delete on atl:devices:<site>:device/<id> (site parent);
devices.job.submit (project scoped) on atl:devices:<site>:job/<id> with the site and project parents.
Lists are filtered with the Lookup scope of devices.device.read; unreadable devices answer 404.
Events: devices.device.v1 (registered, updated, status_changed, credentials_rotated, deleted),
devices.job.v1 (queued, done, failed, cancelled), devices.print.v1 (recorded, attributed).
Authentication
- API Key: session
- HTTP: Bearer Auth
Security Scheme Type: | apiKey |
|---|---|
Cookie parameter name: | atl_session |
Security Scheme Type: | http |
|---|---|
HTTP Authorization Scheme: | bearer |