Create Holiday (v1)
Method & Path
POST /api/v1/workspace/:workspaceId/holidays
Description
Create a new holiday for a workspace.
Authentication
Required: Workspace authentication. User must be authenticated as Workspace Owner or Staff with workspace settings management permissions.
Headers
Authorization: Bearer <workspace_token>
Content-Type: application/json
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
Request Body
{
"name": "New Year's Day",
"date": "2025-01-01T00:00:00.000Z",
"isRecurring": false,
"recurrenceRule": null
}
Request Body Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Holiday name (min: 1, max: 200 characters) |
date | string | Yes | Holiday date (ISO 8601 datetime format) |
isRecurring | boolean | No | Whether the holiday recurs (default: false) |
recurrenceRule | object | No | Recurrence rule (required if isRecurring is true) |
recurrenceRule.frequency | string | No | Recurrence frequency (daily, weekly, monthly, yearly) |
recurrenceRule.dayOfWeek | number | No | Day of week (0-6, Sunday-Saturday) for weekly recurrence |
Response 201 Created
{
"holiday": {
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"name": "New Year's Day",
"date": "2025-01-01T00:00:00.000Z",
"isRecurring": false,
"recurrenceRule": null,
"createdAt": "2024-12-01T10:00:00.000Z",
"updatedAt": "2024-12-01T10:00:00.000Z"
}
}
Common Errors
400 Bad Request: Invalid request body (e.g., missing required fields, invalid date format, invalid recurrence rule)
401 Unauthorized: Missing or invalid authentication token
403 Forbidden: User does not have permission to create holidays
404 Not Found: Workspace not found
422 Unprocessable Entity: Validation error (e.g., invalid recurrence rule configuration)
500 Internal Server Error: Server error occurred while processing the request
Notes
- Holiday dates are stored in UTC timezone
- Recurring holidays require a valid
recurrenceRuleconfiguration - For weekly recurrence,
dayOfWeekmust be specified (0 = Sunday, 6 = Saturday) - Workspace subscription status is checked before processing the request