Skip to main content
Shift templates let the solver generate shifts that fit your time demand. Rather than listing every possible shift in shifts, define the start and end windows, duration range, and work that a generated shift can contain.
Shift templates are available only for TIME_DEMAND rosters. Set context.demandType to TIME_DEMAND, provide the required timeSlots and time demands, then add templates under extensions.shiftTemplates.

Send shift templates in a roster request

Each template needs an id, a start window, an end window, a duration range, and at least one interval. The interval describes the work in the generated shift. In this example, the solver can generate a day shift that starts between 08:00 and 09:00, ends between 16:00 and 17:00, and lasts seven to eight hours.
Add a shift template to a TIME_DEMAND request
The solver considers start-time and duration combinations whose resulting end time falls inside the end window. A template’s labels and attribute requirements are copied to the generated shifts.

Read generated template shifts from the result

Only template shifts assigned in the created roster are returned. Find their definitions in roster.extensions.templateShifts; assignments that use them refer to the same generated shift id. Each generated shift includes its concrete intervals and the shiftTemplateId that links it back to the template you sent. Generated IDs use the reserved template: namespace and are numbered separately for each template.
Template shifts in a roster result
Shift templates will gain more configuration options in future releases, including break intervals and available days.