Authoritative reference: docs/API.md. Developer handover: docs/HANDOVER.md. Below is a short browser summary for integrations.
If API_KEY is set on the server, send header x-api-key: <key> on every
/api/* request. GET /health and device traffic under /iclock/* do not use this key.
The terminal serial number is the device SN. Use the same value as
serialNumber when adding a device, and inside sync.deviceSerialNumbers or
?devices=SN1,SN2 when pushing employees to selected devices. Employee pin is different:
it is the user ID on the terminal.
| Name | Where | Example |
|---|---|---|
serialNumber |
Body for POST /api/devices; exact terminal SN |
"ADZV25060001" |
:id |
/api/devices/:id; numeric DB id or serial number |
/api/devices/ADZV25060001 |
sync.deviceSerialNumbers |
JSON body for employee create/update/resync/disable/delete | ["ADZV25060001"] |
devices |
Query param for multipart face upload | ?devices=ADZV25060001,ADZV25060002 |
/api/employees| Method | Path | Description |
|---|---|---|
GET |
/api/employees |
List all employees |
POST |
/api/employees |
Create (pin, name required). Optional accessValidFrom/accessValidUntil (ISO) or startDatetime/endDatetime (Unix sec). Optional sync → USER_ADD |
GET |
/api/employees/:pin |
Get one employee JSON |
PUT |
/api/employees/:pin |
Update fields (incl. access window ISO or Unix); optional sync for USER_MODIFY |
POST |
/api/employees/:pin/disable |
Sets disabled: true; ADMS per .env (default DISABLE_STRATEGY=both). Response includes disablePolicy. Optional sync |
DELETE |
/api/employees/:pin |
Delete; optional sync for USER_DEL first |
POST |
/api/employees/:pin/face |
Multipart field photo (JPEG/PNG). Query ?devices= optional |
GET |
/api/employees/:pin/face |
Download stored face image |
POST |
/api/employees/:pin/resync |
USER_ADD + PHOTO_UPLOAD if photo; includeRemoteEnroll ignored (legacy) |
POST |
/api/employees/:pin/remote-enroll |
VL face: optional multipart photo; queues USER_ADD + PHOTO_UPLOAD (not ENROLL_BIO); response explains profile vs template |
POST |
/api/employees/:pin/enroll-bio |
REMOTE_ENROLL / ENROLL_BIO — interactive at device; optional userAddFirst |
POST |
/api/employees/:pin/force-template |
Experimental: USER_MODIFY + PHOTO_UPLOAD + QUERY_BIOPHOTO — no template guarantee |
GET |
/api/employees/:pin/adms-queue |
Debug: pending commands for PIN |
Additional endpoints: photo-from-device, transfer-face — see docs/API.md.
curl -sS -X POST "$BASE/api/employees" \
-H "Content-Type: application/json" \
-H "x-api-key: $KEY" \
-d '{"pin":"1001","name":"Jane Doe","verifyMode":15,"sync":{"deviceSerialNumbers":["ADZV25060001"]}}'
curl -sS -X PUT "$BASE/api/employees/1001" \
-H "Content-Type: application/json" \
-H "x-api-key: $KEY" \
-d '{"name":"Jane Q. Doe","disabled":false}'
/api/devices
POST /api/devices pre-registers a terminal. Send serialNumber as the exact terminal
SN. GET/PUT/PATCH/DELETE /api/devices/:id accepts either the numeric database id
returned by GET /api/devices or the same serial number. DELETE .../pending-commands
clears the ADMS queue for that device.
| Field | Required | Notes |
|---|---|---|
serialNumber |
Yes on create | Exact terminal SN; later used in sync.deviceSerialNumbers |
name, group |
No | Human label and sync grouping label, e.g. entrance |
deviceKind |
No | ATTENDANCE, REGISTRATION, or ACCESS |
devicePurpose / device_purpose |
No | Alias: attendance, registration, or access |
role |
No | Enrollment, Access, or Both; controls employee push targeting |
curl -sS -X POST "$BASE/api/devices" \
-H "Content-Type: application/json" \
-H "x-api-key: $KEY" \
-d '{"serialNumber":"ADZV25060001","name":"Front door SpeedFace","group":"entrance","deviceKind":"ACCESS","role":"Access"}'
/api/syncGET /api/sync/overview — devices + queue countsPOST /api/sync/clear-command-queue — body {"all":true} or {"deviceSerialNumbers":["SN"]}/api/events
GET /api/events/live — live attendance history rows. Optional query filters:
deviceSN (or SN/sn), pin, from,
to, and limit (default 50, max 500).
curl -sS "$BASE/api/events/live?deviceSN=ADZV25060001&pin=1001&limit=100" \ -H "x-api-key: $KEY"
Connect to the server origin; path /socket.io/. Emit subscribe with
{ "rooms": ["all", "device-<serial>"] }. Listen for live-attendance.
/iclock/*Used by terminals (SpeedFace, etc.), not your HR integration. See README and src/routes/iclock.ts.
Full tables and field lists: docs/API.md
Face photo not applying on the terminal: docs/TROUBLESHOOTING-FACE-SYNC.md