Skip to main content

List Sessions (v1)

Method + Path​

GET /v1/workspace/:workspaceId/sessions

Actual backend path: /v1/workspace/:workspaceId/sessions

Description​

Get a list of all sessions in a workspace, optionally filtered by client, services, date range, or status.

Authentication​

Required - JWT token in Authorization header

Required Permissions:

  • sessions.view

Headers​

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>

Path Parameters​

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier

Query Parameters​

ParameterTypeRequiredDescription
clientIdstringNoFilter by client ID
serviceIdsstringNoFilter by service IDs (comma-separated, e.g., "id1,id2"). Sessions with any of the specified services will be returned
dateFromstringNoFilter sessions from this date (ISO 8601 datetime)
dateTostringNoFilter sessions to this date (ISO 8601 datetime)
statusstringNoFilter by status. Valid values: scheduled, in-progress, completed, cancelled

Response (200)​

{
"sessions": [
{
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f191e810c19729de860ea",
"clientId": "507f1f77bcf86cd799439012",
"clientName": "John Doe",
"serviceIds": ["507f1f77bcf86cd799439013", "507f1f77bcf86cd799439014"],
"serviceNames": ["استشارة طبية", "فحص عام"],
"staffId": "507f1f77bcf86cd799439015",
"staffName": "Dr. Smith",
"name": "Consultation Session",
"date": "2024-01-20T00:00:00.000Z",
"startTime": "10:00",
"endTime": "11:30",
"durationMinutes": 90,
"status": "scheduled",
"fieldValues": [],
"attachments": [],
"notes": [],
"invoice": null,
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:00:00.000Z"
}
]
}

Common Errors​

  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Insufficient permissions (requires sessions.view)
  • 404 Not Found: Workspace not found
  • 500 Internal Server Error: Server error