Add

[POST] .../v1/workschedule/add

Creates work schedule. Use this method to create a work schedule before configuring intervals, exceptions and assignments. The method validates name and schedule_type, validates check_in_allowed_ips when supplied, checks work schedule add permission 690, inserts the schedule, optionally makes it account default, writes an action log record, invalidates WorkTime cache and returns new_id. The request body is required, schedule_type must be Weekly or Shift, check-in tolerance values are stored in seconds and check_in_allowed_ips accepts IP addresses or CIDR ranges when the account database schema supports the field. Missing body, missing name, invalid schedule_type, invalid or unsupported IP/CIDR restrictions, denied permission and database errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
active Boolean Optional Active schedule flag.
check_in_allowed_ips Array of String Optional Allowed IP/CIDR values for check-in. null or an empty array disables the restriction.
check_in_early_sec Int32 Optional Allowed early check-in time in seconds.
check_in_late_sec Int32 Optional Allowed late check-in time in seconds.
is_account_default Boolean Optional Make the schedule the default for the account.
name String Required Schedule name. Stored in a database field with a 200 character limit.
schedule_type String Required Schedule type: Weekly or Shift. Allowed values: Default, Weekly, Shift.

Request Example

{
  "name": "Front desk weekly schedule",
  "schedule_type": "Weekly",
  "is_account_default": false,
  "check_in_early_sec": 900,
  "check_in_late_sec": 600,
  "check_in_allowed_ips": [
    "203.0.113.10",
    "192.168.1.0/24"
  ],
  "active": true
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Insert Created record result.

Response Example

{
  "ok": true,
  "result": {
    "new_id": 14
  }
}