Skip to content

Creates a work schedule.

Method create.schedules
Description Creates a work schedule.
Who has access Agents and clients

Request parameters

Name Type Required Valid values Description
access_token string yes Access token used to authenticate the request.
user_id number no Unique ID of the client user on whose behalf the agent is making the request. Required for agents. To retrieve a list of client users, use get.customer_users.
name string yes Work schedule name.
Schedule rules
schedules array yes Rules that define when the work schedule is active.
activity_days object yes Days on which this schedule rule is active.
type enum yes days_of_week; days_of_month; business_calendar; cycle Schedule type: days_of_week - weekly schedule; days_of_month - monthly schedule by calendar date; business_calendar - schedule based on the business calendar; cycle - repeating work/rest cycle.
days array yes For days_of_week: 0 - Sunday; 1 - Monday; 2 - Tuesday; 3 - Wednesday; 4 - Thursday; 5 - Friday; 6 - Saturday. For days_of_month: integers from 1 to 31. For cycle: [working days, non-working days]. For business_calendar: 7 - working days; 8 - non-working days. Days on which the rule is active. For a cycle, [2, 2] means two working days followed by two non-working days. For a business calendar, [7] selects working days and [8] selects non-working days.
Active time ranges
activity_time arrayno Time ranges during which the rule is active. If omitted, the rule is active all day.
time_from string yes HH:MM Start time of the active range.
time_till string yes HH:MM End time of the active range. Must be later than time_from.
Active date range
activity_date_from string no YYYY-MM-DD Start date of the active period.
activity_date_till string no YYYY-MM-DD End date of the active period.

Response parameters

Name Type Required Description
id number yes Unique work schedule ID.

Example request

{
  "jsonrpc":"2.0",
  "id":"number",
  "method":"create.schedules",
  "params":{
    "access_token":"string",
    "user_id":"number",
    "name":"string",
    "schedules":[
      {
        "activity_days":{
          "type":"enum",
          "days":[
          ]
        },
        "activity_time":[
          {
            "time_from":"string",
            "time_till":"string"
          }
        ],
        "activity_date_from":"string",
        "activity_date_till":"string"
      }
    ]
  }
}

Example response

{
  "jsonrpc":"2.0",
  "id":"number",
  "result":{
    "id":"number"
  }
}

Possible errors

See the "Errors for create methods" section.