# Put a person on a shift

Creates one assignment against the shift in the URL, at the status you name, and
returns it.
The created record carries only the fields the create set - the rest are filled
in as the shift runs - so read it back if you need the full shape.
**`swap_from_shift_id` turns this into a move rather than an add.** Send it and
the person is taken off that shift as part of the same request, then put on this
one; their assignment on the old shift is deleted, along with the same person's
assignment for any family member you named. Leave it out and nothing is removed.
Because it changes what the endpoint does, it is also authorised differently: a
plain add needs only the access to create an assignment, while a move needs
either the access to move people between shifts or both create **and** delete.
A caller without that gets a 404 rather than a create.
`family_member_ids` adds several people in one call - the person in `user_id`
plus any of their own family members you name. The response is the assignment for
`user_id`; read the shift's assignments back for the rest.
`repeat` extends the create to every later shift linked to this one, so one call
can put someone on a whole recurring series.
A status the account treats as cancelled is refused, and so is a `demand` larger
than the places the shift has left. Both come back as a 422 naming the field.
Beyond the fields listed here the endpoint also accepts the account's own
configured attributes for an assignment.
This endpoint honours the `trigger_automation` request option. It honours
`dry_run` **only for callers whose access allows it** - for anyone else the
option is ignored and the write goes ahead, with no sign in the response that a
preview was asked for. See **Request options**.

Endpoint: POST /api/v2/event/{event_id}/shift/{shift_id}/user
Version: 2.0.0
Security: default

## Path parameters:

  - `event_id` (integer, required)
    The ID of the event.

  - `shift_id` (integer, required)
    The ID of the shift.

## Header parameters:

  - `Rosterfy-Platform` (string)

## Request fields (application/json):

  - `event_shift_status_id` (integer, required)
    The status the assignment starts at, or moves to. Must be one of the account's own shift statuses; a status the account treats as cancelled is refused.

  - `user_id` (integer, required)
    The ID of the person to put on the shift.

  - `is_leader` (boolean)
    Whether this person leads the shift. Setting it on a shift that already has as many leaders as it allows returns a 405 - see the description.

  - `start_timestamp` (string)
    When the person checked in, as `YYYY-MM-DDTHH:MM`. Clearing it while an end time is still set is refused.

  - `end_timestamp` (string)
    When the person checked out, as `YYYY-MM-DDTHH:MM`.

  - `break` (number)
    Unpaid break taken during the shift, in minutes. Subtracted from the attended time.

  - `repeat` (boolean)
    Apply the same change to this person's assignments on every later shift linked to this one. Only meaningful on a shift that belongs to a linked series.

  - `timesheet_status` (string)
    Where the assignment sits in timesheet approval.

  - `family_member_ids` (array)
    IDs of family members of `user_id` to put on the shift alongside them. Only members of that person's own family are used; anything else is ignored.

  - `swap_from_shift_id` (integer)
    Move the person off this shift as part of the same request - see the description.

  - `custom_*` (string)
    A custom attribute, named by its code - custom_shirt_size, for example. The value follows the attribute's own type, so it may be a string, a number, a boolean or a list. See the custom attributes documentation.

## Response 201 fields (application/json):

  - `object` (object)

  - `object.timesheet_status` (string)

  - `object.event_shift_status_id` (integer)

  - `object.user_id` (integer)

  - `object.event_shift_id` (integer)

  - `object.cost_meta` (array)

  - `object.updated_at` (string)

  - `object.created_at` (string)

  - `object.id` (integer)

  - `nice` (object)

  - `nice.rrn` (string)

  - `nice.journey_step` (string)

  - `nice.journey_step_category` (string)

  - `nice.created_at` (string)

  - `nice.created_at__date` (string)

  - `nice.created_at__time` (string)

  - `nice.created_at__offset` (string)

  - `nice.created_at__offset_minutes` (integer)

  - `nice.created_at__dayofweek` (string)

  - `nice.event_shift_status_id` (string)

  - `nice.event_shift_status_id:value` (integer)

  - `nice.event_shift_status_id:array` (string)

  - `nice.payment_authorization_id` (string)

  - `nice.timesheet_status` (string)

  - `nice.timesheet_status:value` (string)

  - `nice.timesheet_status:array` (string)

  - `nice.updated_at` (string)

  - `nice.updated_at__date` (string)

  - `nice.updated_at__time` (string)

  - `nice.updated_at__offset` (string)

  - `nice.updated_at__offset_minutes` (integer)

  - `nice.updated_at__dayofweek` (string)

  - `nice.attended` (object)

  - `nice.attended.seconds` (integer)

  - `nice.attended.minutes` (integer)

  - `nice.attended.hours` (integer)

  - `nice.attended.pretty` (string)

  - `nice.attended_without_checkout` (object)

  - `nice.attended_without_checkout.seconds` (integer)

  - `nice.attended_without_checkout.minutes` (integer)

  - `nice.attended_without_checkout.hours` (integer)

  - `nice.attended_without_checkout.pretty` (string)

  - `nice.event_id` (integer)

  - `nice.event_name` (string)

  - `nice.is_event_leader` (boolean)

  - `nice.is_leader` (boolean)

  - `nice.checkin_location` (array)

  - `nice.shift_name` (string)

  - `nice.user_name` (string)

  - `nice.requires_pre_checkin` (boolean)

  - `nice.has_shift_attended_form` (boolean)

  - `nice.has_checkin_form` (boolean)

  - `nice.has_checkout_form` (boolean)

  - `nice.shift_checkin_visible_attributes` (array)

  - `nice.has_confirmed` (boolean)

  - `nice.has_rejected` (boolean)

  - `nice.has_cancelled` (boolean)

  - `relations` (object)

  - `permissions` (object)

  - `permissions.read` (boolean)

  - `permissions.update` (boolean)

  - `permissions.delete` (boolean)

  - `permissions.status_update` (boolean)

  - `permissions.precheckin` (boolean)

  - `permissions.checkin` (boolean)

  - `permissions.checkout` (boolean)

  - `permissions.submitAttendedForm` (boolean)

  - `attributes` (object)

  - `is_leader` (integer)

