Create a business schedule

post/v1/schedules
Requires any one of these rolesAbout roles
org.permission.schedule.create
Legacyorg.admin.schedule.write

The API key or user must hold at least one of them. Legacy roles still work; prefer the others for new keys.

Creates a new business schedule.

About this resource

Business schedules

A business schedule defines your support team's working hours for each day of the week in one time zone, plus holidays when you're closed. Kustomer uses it to measure time in business hours, for SLAs, reporting, chat availability and workflow conditions.

Admins set business schedules in the Kustomer admin settings, usually one per support region or team. Exactly one schedule is the org's default (default: true). Making another schedule the default, on create or update, clears the flag on the old one. Deleting a schedule is a soft delete: the response returns it with deleted: true and deletedAt, and it stops being the default.

Hours and time zone

hours has one key per weekday, "0" for Sunday through "6" for Saturday. Each day is either null (closed all day) or a list of [start, end] intervals in minutes after local midnight, from 0 to 1440. Intervals must be sorted, can't overlap or touch, and must end after they start. A Monday to Friday, 8:00 to 17:00 schedule looks like this:

{ "0": null, "1": [[480, 1020]], "2": [[480, 1020]], "3": [[480, 1020]], "4": [[480, 1020]], "5": [[480, 1020]], "6": null }

Split shifts are just more intervals, such as [[480, 720], [780, 1020]]. timezone is an IANA time zone name such as America/New_York, so the hours follow local time, including daylight saving changes.

Holidays

Holidays are separate objects attached to a schedule. Each has a name, description, startDate, endDate and enabled. Enabled holidays count as closed time even when they fall inside the weekly hours, and disabled ones are ignored. Holidays aren't returned by default: add include=holidays to the read endpoints and they appear in the top-level included array, each linked back to its schedule.

How schedules affect SLAs, routing and automation

  • SLAs. An SLA can count time in calendar hours (around the clock) or business hours. With business hours, deadlines only advance while the schedule is open and pause outside hours and on holidays. An SLA can name a specific schedule; otherwise the default schedule applies.
  • Business-time metrics. The default schedule is what Kustomer uses for business-time measurements, such as the businessTime totals on routing work sessions and conversation timing.
  • Chat. Chat availability follows a business schedule, the org default unless chat settings choose another.
  • Workflows. The inBusinessHours function and the in_business_hours criteria operator check a date against a schedule ID.

Which endpoint to use

To Call
List schedules GET /v1/schedules, with enabled=true for enabled schedules only
Get the default schedule, for example to check opening hours GET /v1/schedules/default, with include=holidays
Create a schedule POST /v1/schedules
Read, replace or delete a schedule GET, PUT or DELETE /v1/schedules/{id}

PUT replaces the schedule: send name, all seven days of hours, timezone and default every time, using null for closed days. Business-hour calculations elsewhere in Kustomer may take a short time to pick up a change.

Request body

application/jsonrequired

### Hours

hours is an object where the key is the day index and the value is an hour tuple.

#### Day index

* 0 is Sunday * 1 is Monday * 2 is Tuesday * 3 is Wednesday * 4 is Thursday * 5 is Friday * 6 is Saturday

#### Hour tuple

Each hour tuple is an array with 2 values that represent the time of day in minutes:

* The first value is the start time (for example, 480 for 8:00 AM) * The second value is the end time (for example, 1020 for 5:00 PM)

For example, the hour tuple [480, 1020] represents 8:00 AM - 5:00 PM.

namestringrequired
max length 256
objectrequired
timezonestringtimezonesrequired
defaultbooleanrequired

Responses

OK

objectrequired