DOBS Logo

DOBS API Documentation

Digital Observation Body-mapping System — REST API Reference

Authentication

POST /api/auth?action=login Login with name + PIN
Auth Required
None
Request Body
{
  "name": "Jane Smith",
  "pin": "1234"
}
Response
200 Sets session cookie and returns staff profile.
{
  "staff": { "id": 1, "name": "Jane Smith", "role": "admin" }
}
401 Invalid credentials.
POST /api/auth?action=logout Clear session
Auth Required
None
Request Body
None
Response
200 Clears auth cookie.
{ "ok": true }
GET /api/auth?action=me Check session / refresh token
Auth Required
Session Cookie / Bearer Token
Response
200 Returns current staff profile with refreshed token.
{
  "staff": { "id": 1, "name": "Jane Smith", "role": "admin" }
}
401 No valid session.
POST /api/auth?action=seed Create default admin
Auth Required
None (first-run only)
Description

Creates the default admin account if no staff members exist. Used during initial setup.

Response
200 Admin created or already exists.
{ "ok": true, "seeded": true }
POST /api/auth?action=reset-pin Reset own PIN
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "currentPin": "1234",
  "newPin": "5678"
}
Response
200 PIN updated successfully.
{ "ok": true }
401 Current PIN incorrect.

Staff Management

GET /api/staff List all staff
Auth Required
Session Cookie / Bearer Token
Response
200 Array of staff members.
{
  "staff": [
    { "id": 1, "name": "Jane Smith", "role": "admin" }
  ]
}
POST /api/staff Add staff member
Auth Required
Admin
Request Body
{
  "name": "New Staff",
  "pin": "1234",
  "role": "staff"
}
Response
201 Created staff member.
{ "staff": { "id": 2, "name": "New Staff", "role": "staff" } }
PUT /api/staff?id=X Update staff member
Auth Required
Admin
Query Parameters
id (required) — Staff member ID
Request Body
{
  "name": "Updated Name",
  "role": "admin"
}
Response
200 Updated staff member.
DELETE /api/staff?id=X Remove staff member
Auth Required
Admin
Query Parameters
id (required) — Staff member ID
Response
200 Staff member removed.
{ "ok": true }

Residents

GET /api/residents List active residents
Auth Required
Session Cookie / Bearer Token
Response
200 Array of active residents.
{
  "residents": [
    { "id": 1, "firstName": "John", "lastName": "Doe", "roomNumber": "12" }
  ]
}
POST /api/residents Add resident
Auth Required
Admin
Request Body
{
  "firstName": "John",
  "lastName": "Doe",
  "roomNumber": "12",
  "dateOfBirth": "1940-05-12"
}
Response
201 Created resident.
PUT /api/residents?id=X Update resident
Auth Required
Session Cookie / Bearer Token
Query Parameters
id (required) — Resident ID
Request Body
{
  "firstName": "John",
  "roomNumber": "14"
}
Response
200 Updated resident record.

Entries (Body Map)

GET /api/entries?periodId=X List entries for period
Auth Required
Session Cookie / Bearer Token
Query Parameters
periodId (required) — Period ID to fetch entries for
Response
200 Array of body map entries.
{
  "entries": [
    {
      "id": 1, "bodyView": "front",
      "injuryType": "bruise", "description": "...",
      "x": 120, "y": 340
    }
  ]
}
POST /api/entries Create body map entry
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "periodId": 1,
  "residentId": 1,
  "bodyView": "front",
  "x": 120,
  "y": 340,
  "injuryType": "bruise",
  "description": "Small bruise on left forearm",
  "actionTaken": "Monitored",
  "remediation": "",
  "followUpDate": "2026-04-15",
  "observationType": "injury",
  "imageUrl": "",
  "woundLength": 2.5,
  "woundWidth": 1.0,
  "woundDepth": 0
}
Response
201 Created entry with optional safeguarding alert.
{
  "entry": { ... },
  "alert": null
}
PUT /api/entries Update entry
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "id": 1,
  "description": "Updated description",
  "actionTaken": "Applied dressing"
}
Response
200 Updated entry object.

Observations

POST /api/entries?action=obs-check Record behavioural observation
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "residentId": 1,
  "location": "Lounge",
  "activity": "Watching TV",
  "mood": 3,
  "asleep": false,
  "riskFlags": ["fall_risk"],
  "notes": "",
  "isIncident": false
}
Response
201 Created observation with optional escalation.
{
  "check": { ... },
  "escalation": null
}
GET /api/entries?action=obs-checks&residentId=X List observations
Auth Required
Session Cookie / Bearer Token
Query Parameters
residentId (required) — Resident ID
from (optional) — Start date ISO string
to (optional) — End date ISO string
Response
200 Array of observation checks.
{ "checks": [ ... ] }
GET /api/entries?action=obs-trends&residentId=X Get trend data
Auth Required
Session Cookie / Bearer Token
Query Parameters
residentId (required) — Resident ID
days (optional, default 7) — Number of days
Response
200 Mood, sleep, incident, and location trends with compliance score.
{
  "moodData": [ ... ],
  "sleepData": [ ... ],
  "incidentData": [ ... ],
  "locationData": [ ... ],
  "compliance": 85,
  "summary": { "avgMood24h": 3.2, "totalChecks": 48 }
}
POST /api/entries?action=obs-vitals Record vital signs
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "residentId": 1,
  "systolic": 120,
  "diastolic": 80,
  "pulse": 72,
  "temperature": 36.8,
  "respRate": 16,
  "o2Saturation": 97,
  "consciousness": "A",
  "supplementalO2": false,
  "notes": ""
}
Response
201 Created vitals record with NEWS2 score and optional escalation.
{
  "vitals": { ..., "news2Score": 2, "news2RiskLevel": "low" },
  "escalation": null
}
POST /api/entries?action=obs-food-fluid Record food/fluid intake
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "residentId": 1,
  "entryType": "fluid",
  "description": "Cup of tea",
  "amountMl": 200,
  "calories": 30,
  "mealPeriod": "morning",
  "refused": false,
  "assistance": "independent",
  "notes": ""
}
Response
201 Created food/fluid entry with optional escalation.
{
  "entry": { ... },
  "escalation": null
}
POST /api/entries?action=obs-neuro Record neurological obs
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "residentId": 1,
  "eyeOpening": 4,
  "verbalResponse": 5,
  "motorResponse": 6,
  "pupilLeft": "reactive",
  "pupilRight": "reactive",
  "limbMovement": "normal",
  "notes": ""
}
Response
201 Created neurological observation with GCS score.
{
  "neuro": { ..., "gcsTotal": 15 },
  "escalation": null
}

Periods

GET /api/periods?residentId=X Get periods for resident
Auth Required
Session Cookie / Bearer Token
Query Parameters
residentId (required) — Resident ID
Response
200 Array of documentation periods.
{
  "periods": [
    { "id": 1, "residentId": 1, "label": "April 2026" }
  ]
}
POST /api/periods Create period
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "residentId": 1,
  "label": "April 2026"
}
Response
201 Created period.

Export

GET /api/export Download PDF/CSV report
Auth Required
Admin
Query Parameters
format (optional) — "csv" for CSV, omit for PDF
type (optional, CSV only) — "entries" | "obs_checks" | "vitals"
residentId (optional) — Filter to single resident
from (optional) — Start date (ISO)
to (optional) — End date (ISO)
includePhotos (optional, PDF only) — "true" to include photos
Response

PDF: Content-Type: application/pdf — Streams the report as a file download.

CSV: Content-Type: text/csv — Returns CSV with columns specific to the type.

CSV Column Reference
entries: Date, Time, Staff, Resident, Room, Type, Category,
  Body View, Description, Action Taken, Remediation,
  Follow-up Date, Wound L/W/D (cm), Photo URL

obs_checks: Date, Time, Staff, Resident, Room, Location,
  Activity, Mood, Asleep, Incident, Risk Flags, Notes

vitals: Date, Time, Staff, Resident, Systolic, Diastolic,
  Pulse, Temp, Resp Rate, O2 Sat, Consciousness, NEWS2 Score

Alerts

GET /api/alerts List safeguarding alerts
Auth Required
Session Cookie / Bearer Token
Response
200 Array of safeguarding alerts.
{
  "alerts": [
    {
      "id": 1,
      "residentId": 1,
      "type": "repeat_location",
      "severity": "high",
      "status": "pending"
    }
  ]
}
PUT /api/alerts Update alert status
Auth Required
Session Cookie / Bearer Token
Request Body
{
  "id": 1,
  "status": "reviewed",
  "notes": "Investigated - no concern"
}
Response
200 Updated alert.