Create Session (v1)
Method + Path
POST /v1/workspace/:workspaceId/sessions
Actual backend path: /v1/workspace/:workspaceId/sessions
Description
Create a new session (appointment) in a workspace.
Authentication
Required - JWT token in Authorization header
Required Permissions:
sessions.create
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
Request Body
{
"name": "Consultation Session",
"clientId": "507f1f77bcf86cd799439012",
"scheduledAt": "2024-01-20T10:00:00Z",
"duration": 60,
"notes": "Initial consultation",
"customFields": [
{
"fieldKey": "session-type",
"value": "consultation"
}
]
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Session name (minimum 1 character) |
clientId | string | Yes | Client ID for the session |
scheduledAt | string | Yes | Scheduled date/time in ISO 8601 format |
duration | number | No | Session duration in minutes |
notes | string | No | Session notes |
customFields | array | No | Array of custom field values |
Response (201)
{
"session": {
"id": "507f1f77bcf86cd799439011",
"name": "Consultation Session",
"clientId": "507f1f77bcf86cd799439012",
"scheduledAt": "2024-01-20T10:00:00Z",
"duration": 60,
"status": "scheduled",
"createdAt": "2024-01-15T10:00:00Z"
}
}
Common Errors
- 400 Bad Request: Invalid request body or validation errors
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions (requires
sessions.create) - 404 Not Found: Workspace or client not found
- 422 Unprocessable Entity: Validation errors
- 500 Internal Server Error: Server error