---
title: "POST /v1alpha1/{+parent}:generateShifts"
method: POST
path: "/v1alpha1/{+parent}:generateShifts"
tags: ["projects"]
---

# POST /v1alpha1/{+parent}:generateShifts

`POST /v1alpha1/{+parent}:generateShifts`

Generates shifts constrained by various parameters.

## Path parameters

- `parent` string, required

## Request body

- GenerateShiftsRequest — Request with constraints for generating shifts. The shifts generated must adhere to these constraints.
  - `solverConfig` SolverConfig — Specifies additional parameters for the solver generating shifts.
    - `maximumProcessingDuration` string, google-duration — Optional. Maximum time the solver should spend on the problem. If not set, defaults to 1 minute. The choice of a time limit should depend on the size of the problem. To give an example, when solving a 7-day instance with 2 `ShiftTemplates`, each with ~20 possible start times and holding 2 events with ~30 possible start times, and two days off per week, recommended values are: <10s for fast solutions (and likely suboptimal), (10s, 300s) for good quality solutions, and >300s for an exhaustive search. Larger instances may require longer time limits. This value is not a hard limit and it does not account for the communication overhead. The expected latency to solve the problem may slightly exceed this value.
    - `scheduleType` 'SCHEDULE_TYPE_UNSPECIFIED' | 'SINGLE_SHIFT' | 'WEEKLY_WITH_FIXED_EVENTS' | 'WEEKLY_WITH_VARIABLE_EVENTS' — Required. Specifies the type of schedule to generate.
  - `shiftTemplates` ShiftTemplate[] — Required. Set of shift templates specifying rules for generating shifts. A shift template can be used for generating multiple shifts.
    - `eventTemplates` EventTemplate[] — Optional. Rules for generating events for each shift. Exactly one event will be included in each shift for each `EventTemplate` specified.
      - `id` string — Required. Unique ID of this template.
      - `minimumMinutesAfterShiftStart` integer — Optional. Minimum number of minutes after the beginning of a shift that this event can start.
      - `durationMinutes` integer — Required. Fixed duration in minutes of this event.
      - `maximumMinutesAfterShiftStart` integer — Optional. Maximum number of minutes after the beginning of a shift that this event can start.
      - `startTimeIncrementMinutes` integer — Required. The time increment (in minutes) used to generate the set of possible event start times between `minimum_minutes_after_shift_start` and `maximum_minutes_after_shift_start`. For example, if the minimum minutes after shift start are 30, maximum minutes after shift start are 45, and the start time increment is 5 minutes, the event can take place 30, 35, 40, or 45 minutes after the start of the shift.
    - `assignableEmployeeIds` string[] — Optional. A list of specific employee IDs that can be assigned to shifts generated by this template. If this field is present, there will be `EmployeeSchedule`s in the response for which the `EmployeeSchedule.employee_id` field is set to one of the IDs in this list. The number of employee schedules with an assigned employee ID will be between `minimum_employee_count` and `maximum_employee_count`. If this field is empty, between `minimum_employee_count` and `maximum_employee_count` employees can be assigned to shifts generated by this template and the employee schedules won't have an assigned employee ID. Currently, only one assignable employee ID is supported.
    - `daysOffDates` DateList — List of dates.
      - `values` Date[] — Optional. Values in the list.
        - `month` integer — Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
        - `year` integer — Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
        - `day` integer — Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
    - `minimumIntereventGapMinutes` integer — Optional. Minimum minutes between the end of one event and the start of the next.
    - `startTimeIncrementMinutes` integer — Optional. The time increment (in minutes) used to generate the set of possible start times between `earliest_start_time` and `latest_start_time`. For example, if the earliest start time is 8:00, the latest start time is 8:30, and the start time increment is 10 minutes, then all possible start times for this shift template are: 8:00, 8:10, 8:20, and 8:30.
    - `maximumEmployeeCount` integer — Required. Maximum number of employees that can be assigned to all shifts generated by this template on working days.
    - `latestStartTime` TimeOfDay — Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
      - `minutes` integer — Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
      - `hours` integer — Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
      - `seconds` integer — Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.
      - `nanos` integer — Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
    - `earliestStartTime` TimeOfDay — Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
      - `minutes` integer — Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
      - `hours` integer — Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
      - `seconds` integer — Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.
      - `nanos` integer — Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
    - `daysOffCountPerWeek` integer — Optional. Fixed number of days off per week. An employee has a given day off if they are not assigned to a shift that starts on that day. A week is 7 days and begins on Sunday.
    - `id` string — Required. Unique ID of this template.
    - `durationMinutes` integer — Required. Fixed duration of a shift generated by this template.
    - `minimumEmployeeCount` integer — Optional. Minimum number of employees that can be assigned to all shifts generated by this template on working days.
  - `employeeInfo` EmployeeInfo[] — Optional. Employee information that should be considered when generating shifts.
    - `id` string — Required. Unique ID of this employee.
    - `unwantedEventIntervals` UnwantedEventInterval[] — Optional. A list of unwanted event intervals for this employee. The start time of the interval must be in the planning horizon.
      - `startTime` DateTime — Represents civil time (or occasionally physical time). This type can represent a civil time in one of a few possible ways: * When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC. * When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone. * When neither time_zone nor utc_offset is set: a civil time on a calendar day in local time. The date is relative to the Proleptic Gregorian Calendar. If year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively. This type may also be used to represent a physical time if all the date and time fields are set and either case of the `time_offset` oneof is set. Consider using `Timestamp` message for physical time instead. If your use case also would like to store the user's timezone, that can be done in another field. This type is more flexible than some applications may want. Make sure to document and validate your application's limitations.
        - `utcOffset` string, google-duration — UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }.
        - `hours` integer — Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value "24:00:00" for scenarios like business closing time.
        - `month` integer — Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.
        - `seconds` integer — Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds.
        - `minutes` integer — Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.
        - `year` integer — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.
        - `day` integer — Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day.
        - `timeZone` TimeZone — Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
          - `id` string — IANA Time Zone Database time zone. For example "America/New_York".
          - `version` string — Optional. IANA Time Zone Database version number. For example "2019a".
        - `nanos` integer — Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.
      - `durationMinutes` integer — Required. Duration of the event.
  - `planningHorizon` PlanningHorizon — Specifies the time interval during which the solver should generate shifts. The start time must be before the end time.
    - `endTime` DateTime — Represents civil time (or occasionally physical time). This type can represent a civil time in one of a few possible ways: * When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC. * When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone. * When neither time_zone nor utc_offset is set: a civil time on a calendar day in local time. The date is relative to the Proleptic Gregorian Calendar. If year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively. This type may also be used to represent a physical time if all the date and time fields are set and either case of the `time_offset` oneof is set. Consider using `Timestamp` message for physical time instead. If your use case also would like to store the user's timezone, that can be done in another field. This type is more flexible than some applications may want. Make sure to document and validate your application's limitations.
      - `utcOffset` string, google-duration — UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }.
      - `hours` integer — Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value "24:00:00" for scenarios like business closing time.
      - `month` integer — Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.
      - `seconds` integer — Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds.
      - `minutes` integer — Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.
      - `year` integer — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.
      - `day` integer — Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day.
      - `timeZone` TimeZone — Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
        - `id` string — IANA Time Zone Database time zone. For example "America/New_York".
        - `version` string — Optional. IANA Time Zone Database version number. For example "2019a".
      - `nanos` integer — Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.
    - `startTime` DateTime — Represents civil time (or occasionally physical time). This type can represent a civil time in one of a few possible ways: * When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC. * When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone. * When neither time_zone nor utc_offset is set: a civil time on a calendar day in local time. The date is relative to the Proleptic Gregorian Calendar. If year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively. This type may also be used to represent a physical time if all the date and time fields are set and either case of the `time_offset` oneof is set. Consider using `Timestamp` message for physical time instead. If your use case also would like to store the user's timezone, that can be done in another field. This type is more flexible than some applications may want. Make sure to document and validate your application's limitations.
      - `utcOffset` string, google-duration — UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }.
      - `hours` integer — Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value "24:00:00" for scenarios like business closing time.
      - `month` integer — Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.
      - `seconds` integer — Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds.
      - `minutes` integer — Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.
      - `year` integer — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.
      - `day` integer — Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day.
      - `timeZone` TimeZone — Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
        - `id` string — IANA Time Zone Database time zone. For example "America/New_York".
        - `version` string — Optional. IANA Time Zone Database version number. For example "2019a".
      - `nanos` integer — Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.
  - `workforceDemands` WorkforceDemandList — List of workforce demands.
    - `values` WorkforceDemand[] — Optional. Values in the list.
      - `employeeCount` integer — Optional. Number of employees needed to cover the demand for this interval.
      - `endTime` DateTime — Represents civil time (or occasionally physical time). This type can represent a civil time in one of a few possible ways: * When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC. * When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone. * When neither time_zone nor utc_offset is set: a civil time on a calendar day in local time. The date is relative to the Proleptic Gregorian Calendar. If year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively. This type may also be used to represent a physical time if all the date and time fields are set and either case of the `time_offset` oneof is set. Consider using `Timestamp` message for physical time instead. If your use case also would like to store the user's timezone, that can be done in another field. This type is more flexible than some applications may want. Make sure to document and validate your application's limitations.
        - `utcOffset` string, google-duration — UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }.
        - `hours` integer — Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value "24:00:00" for scenarios like business closing time.
        - `month` integer — Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.
        - `seconds` integer — Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds.
        - `minutes` integer — Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.
        - `year` integer — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.
        - `day` integer — Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day.
        - `timeZone` TimeZone — Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
          - `id` string — IANA Time Zone Database time zone. For example "America/New_York".
          - `version` string — Optional. IANA Time Zone Database version number. For example "2019a".
        - `nanos` integer — Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.
      - `startTime` DateTime — Represents civil time (or occasionally physical time). This type can represent a civil time in one of a few possible ways: * When utc_offset is set and time_zone is unset: a civil time on a calendar day with a particular offset from UTC. * When time_zone is set and utc_offset is unset: a civil time on a calendar day in a particular time zone. * When neither time_zone nor utc_offset is set: a civil time on a calendar day in local time. The date is relative to the Proleptic Gregorian Calendar. If year, month, or day are 0, the DateTime is considered not to have a specific year, month, or day respectively. This type may also be used to represent a physical time if all the date and time fields are set and either case of the `time_offset` oneof is set. Consider using `Timestamp` message for physical time instead. If your use case also would like to store the user's timezone, that can be done in another field. This type is more flexible than some applications may want. Make sure to document and validate your application's limitations.
        - `utcOffset` string, google-duration — UTC offset. Must be whole seconds, between -18 hours and +18 hours. For example, a UTC offset of -4:00 would be represented as { seconds: -14400 }.
        - `hours` integer — Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults to 0 (midnight). An API may choose to allow the value "24:00:00" for scenarios like business closing time.
        - `month` integer — Optional. Month of year. Must be from 1 to 12, or 0 if specifying a datetime without a month.
        - `seconds` integer — Optional. Seconds of minutes of the time. Must normally be from 0 to 59, defaults to 0. An API may allow the value 60 if it allows leap-seconds.
        - `minutes` integer — Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0.
        - `year` integer — Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a datetime without a year.
        - `day` integer — Optional. Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a datetime without a day.
        - `timeZone` TimeZone — Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
          - `id` string — IANA Time Zone Database time zone. For example "America/New_York".
          - `version` string — Optional. IANA Time Zone Database version number. For example "2019a".
        - `nanos` integer — Optional. Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999, defaults to 0.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/contactcenteraiplatform.md) · [All operations](https://skmtc.dev/google/apis/contactcenteraiplatform/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/contactcenteraiplatform/revisions/a7344cbf57c4/schema)
