Assign an associate to a path
POST/associates/:id/assignments
Puts an associate on pathId for a new interval, raising LaborAssigned (first assignment) or LaborReassigned (an assignment was already active). The "exactly one ACTIVE assignment per associate" invariant is enforced by construction, not by rejecting a second call: if the associate already has an active assignment, it is closed first (its hours are logged against the associate's shift) and the new one starts — this matches how rebalancing actually happens on the floor, a supervisor moves someone without first "unassigning" them. The assignment requires the associate hold the path's required certification (by convention, the Certification with the same name as the PathId — e.g. path "pack" requires certification "pack"), and is rejected if the associate is currently on a logged break or their shift has ended. Because each call closes the prior interval and raises an event, a blind retry would double-apply it, so this route is protected by the Idempotency-Key header (ADR-0027, ADR-0044): a retried request with the same key and body replays the first response — unless the first answer was RETRYABLE (e.g. certification-required, associate-on-break, concurrent-modification), which is not stored: the key is released and the retry executes again once the state allows it.
Request
Responses
- 201
- 400
- 404
- 409
- 500
Associate assigned. Location points at this associate's assignment resource (at most one active assignment exists per associate, so the collection URI identifies it).
Response Headers
"true" when this answer is the stored replay of an earlier request with the same Idempotency-Key and fingerprint; absent on the first execution.
URI of the associate's assignment resource.
Malformed JSON body, or a required field was missing/empty (empty-associate-id, empty-path-id, empty-certification, missing-building-id -- neither siteCode nor its deprecated alias buildingId was sent --, missing-shift-id, missing-charge, unknown-path-id -- a pathId the process-path catalogue does not declare --, or malformed-request-body). The two staffing-gap list routes also answer 400 for a bad paging query: invalid-limit (not an integer 1-500, empty or repeated), invalid-cursor (undecodable or repeated) and unknown-query-parameter (any query parameter other than limit, cursor and, on the deprecated route, siteCode). On every POST a missing Idempotency-Key header is also a 400 (idempotency-key-required) and a malformed one (not 1-128 printable ASCII starting and ending with a visible character) a 400 (idempotency-key-invalid).
The referenced associate has no started shift (resource-not-found).
Conflict — the associate lacks the required certification for this path (certification-required), is currently on a logged break (associate-on-break), their shift has ended (associate-shift-ended), closing the prior active assignment would push logged hours over the configured max per shift (max-hours-exceeded), or this associate's roster entry or active assignment was concurrently modified by another request between when it was read and when this write was attempted (concurrent-modification, ADR 0021); reload and retry. Also returned (idempotency-key-reused) when the Idempotency-Key was already used with a different request (method, path or body).
Unclassified failure (e.g. a persistence or event-publish error) — internal-error.