Skip to main content

List Referral Lab Visits (v1)

Method & Path

GET /api/v1/workspace/:workspaceId/referrals/:referralId/lab-visits

Actual backend path: /v1/workspace/:workspaceId/referrals/:referralId/lab-visits

Description

Lists all lab visits that are associated with a specific referral (الإحالة) within the workspace.

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

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier (MongoDB ObjectId)
referralIdstringYesReferral identifier (MongoDB ObjectId)

Query Parameters

None.

Response 200 OK

{
"labVisits": [
{
"id": "507f1f77bcf86cd799439011",
"clientId": "507f1f77bcf86cd799439013",
"clientName": "John Doe",
"labVisitType": "in-lab",
"labVisitStatus": "pending",
"labVisitDate": "2026-01-10T12:00:00.000Z",
"totalAmount": 90,
"createdAt": "2026-01-10T12:00:00.000Z"
}
]
}

Common Errors

  • 400 Bad Request: Invalid identifiers
  • 401 Unauthorized: Missing/invalid JWT
  • 404 Not Found: Workspace or referral not found
  • 500 Internal Server Error: Unexpected error