Skip to main content

Update Working Hours (v1)

Method + Path

PATCH /v1/workspace/:workspaceId/working-hours

Actual backend path: /v1/workspace/:workspaceId/working-hours

Description

Update workspace working hours. Working hours define when the workspace is open for business.

Authentication

Required - JWT token in Authorization header

Required Permissions:

  • workspace.update

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier

Request Body

{
"days": [
{
"day": 0,
"isOpen": false
},
{
"day": 1,
"isOpen": true,
"startTime": "09:00",
"endTime": "17:00"
},
{
"day": 2,
"isOpen": true,
"startTime": "09:00",
"endTime": "17:00"
},
{
"day": 3,
"isOpen": true,
"startTime": "09:00",
"endTime": "17:00"
},
{
"day": 4,
"isOpen": true,
"startTime": "09:00",
"endTime": "17:00"
},
{
"day": 5,
"isOpen": true,
"startTime": "09:00",
"endTime": "17:00"
},
{
"day": 6,
"isOpen": false
}
],
"timezone": "America/New_York"
}

Body Parameters

ParameterTypeRequiredDescription
daysarrayYesArray of 7 day objects (one for each day 0-6, Sunday-Saturday)
days[].daynumberYesDay number (0 = Sunday, 6 = Saturday)
days[].isOpenbooleanYesWhether the workspace is open on this day
days[].startTimestringConditionalStart time in HH:MM format (required if isOpen is true)
days[].endTimestringConditionalEnd time in HH:MM format (required if isOpen is true, must be after startTime)
timezonestringNoTimezone identifier (e.g., "America/New_York")

Response (200)

{
"workspace": {
"id": "507f1f77bcf86cd799439011",
"workingHours": {
"days": [
{
"day": 0,
"isOpen": false
},
{
"day": 1,
"isOpen": true,
"startTime": "09:00",
"endTime": "17:00"
}
],
"timezone": "America/New_York",
"updatedAt": "2024-01-15T11:00:00Z"
}
}
}

Common Errors

  • 400 Bad Request: Invalid request body, missing days, invalid times, or endTime before startTime
  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Insufficient permissions (requires workspace.update)
  • 404 Not Found: Workspace not found
  • 422 Unprocessable Entity: Validation errors
  • 500 Internal Server Error: Server error