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
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
clientId | string | No | Filter by client ID |
serviceIds | string | No | Filter by service IDs (comma-separated, e.g., "id1,id2"). Sessions with any of the specified services will be returned |
dateFrom | string | No | Filter sessions from this date (ISO 8601 datetime) |
dateTo | string | No | Filter sessions to this date (ISO 8601 datetime) |
status | string | No | Filter 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