Skip to main content

Get Lab Visit Test Results (v1)

Method & Path

GET /api/v1/workspace/:workspaceId/labs/visits/:labVisitId/test-results

Actual backend path: /v1/workspace/:workspaceId/labs/visits/:labVisitId/test-results

Description

Get entered test results for a lab visit. Results are keyed by testId and a composite node key in the format SectionName::nodeId (from the test design).

Notes:

  • If stored results include legacy numeric node keys (e.g. "12": "..."), the backend will normalize them to composite keys when unambiguous based on the visit’s labTestSnapshots[].designTest.
  • nodeResults values may be either:
    • Legacy/simple value: "Section::12": "35"
    • Structured value with visit-only overrides:
      • unitOverride: override the unit for this visit only
      • rangeOverride: override the displayed "normal range" for this visit only (and for numeric nodes, used for indicator high/low)

Authentication

Required: JWT token in Authorization header

Persona Access:

  • Admin: Not applicable (workspace-scoped endpoint)
  • Workspace Owner: Allowed (root persona for workspace features)
  • Staff: Allowed (role-based)
  • Customer: Not allowed

Required Permissions:

  • labs.view

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
X-Staff-IdstringNoStaff member ID (used for staff permission checks; omit for Workspace Owner access)

Query Parameters

ParameterTypeRequiredDescription
staffIdstringNoAlternative to X-Staff-Id header

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier (MongoDB ObjectId)
labVisitIdstringYesLab visit identifier (MongoDB ObjectId)

Response 200 OK

{
"testResults": [
{
"testId": 286406,
"nodeResults": {
"Section-1::1": "Positive",
"Section-1::2": {
"value": "42",
"unitOverride": "g/dl",
"rangeOverride": { "kind": "num", "from": 13.5, "to": 18 }
}
},
"updatedAt": "2026-01-11T10:00:00.000Z",
"updatedBy": {
"type": "staff",
"id": "507f1f77bcf86cd799439099",
"name": "Staff Member",
"email": "staff@example.com"
}
}
]
}

Common Errors

401 Unauthorized: Missing or invalid authentication token

403 Forbidden: Insufficient permissions (labs.view required)

404 Not Found: Workspace or lab visit not found

422 Validation Error: Invalid workspace/lab visit ID format