Assign Shift
Assigns one shift to one or more people for a period, exactly as an administrator would from Attendance in Crehana. Built for HR and workforce-planning systems that own the schedule and push it to Crehana. Step-by-step guide: Assign shifts.
Once assigned, the shift drives the attendance of those days: marks are matched to it, punctuality is classified against it and the daily attendance is recalculated.
start_dateandend_dateare calendar days, inclusive;end_dateis optional for an open-ended assignment.- A rotating shift needs
start_cycle_id, the cycle it starts with onstart_date. A fixed shift takes no cycle. - If a person already has a shift that overlaps the new one in that period, the previous assignment is deactivated and the new one takes its place. Once shifts are allowed to coexist on the same day, an overlap is rejected instead:
409with one conflict per person, and nobody gets the shift (all-or-nothing). - Sending the same assignment again is safe: people who already have this exact shift in this period are listed in
already_assigned_user_ids, nothing is duplicated and the answer is200when there is nothing new. - The shift must belong to the organization and be active, and every person must belong to it, otherwise
404(detail.codesays which). - Requires credentials of an administrator of the organization.
Authentication
API key of the organization. Always sent together with the Secret-Access header.
Path parameters
Headers
Request
Centralized ids of the people who get the shift: user.id in GET /org/{organization_slug}/users/user-organizations/. Not the learning user id. Between 1 and 100 ids, without repeats. The request is all-or-nothing: if one person cannot take the shift, nobody gets it.
First day of the assignment, YYYY-MM-DD.
Last day of the assignment, YYYY-MM-DD, inclusive. Omit it or send null for an open-ended assignment.
For rotating shifts only: id of the cycle the rotation starts with on start_date. Required for a rotating shift, and must be omitted for a fixed one.
Response
Everybody already had this shift in this period; nothing new
attendance-003 when at least one assignment was created, attendance-004 when everybody already had the shift. Not an HTTP status.
