Assign shift operator
Assign an operator to a shift by its id (as returned by GET /v1/shifts), including shifts that
have already ended. Without start, the operator takes over from the start of the shift.
How operator assignments add up. Each shift keeps a timeline of who ran the machine. An
assignment means "from start on, this operator runs the machine": it lasts until the end of the
shift, or until the next assignment.
- First assignment. If nobody is assigned to the shift yet, the operator covers the whole
shift, from its first minute, even when
startis later. - Later assignments. Each one splits the timeline at
start: whoever held the machine keeps it untilstart, and the new operator takes it fromstartto the end of the shift. - Order matters. Send assignments in chronological order. A
startearlier than the shift's latest change is rejected with400, so you cannot insert an operator in the middle afterwards. Astartequal to the latest change replaces the operator who took over then. - Retries are safe. Sending the same assignment again changes nothing.
startis rounded down to the minute.
For example, for a Morning shift from 06:00 to 14:00 with nobody assigned yet:
| Request | Timeline after it |
|---|---|
| operator 1063 from 10:00 | 1063 06:00–14:00 (the first assignment covers the whole shift) |
| operator 2071 from 10:00 | 1063 06:00–10:00, 2071 10:00–14:00 |
| operator 3300 from 12:00 | 1063 06:00–10:00, 2071 10:00–12:00, 3300 12:00–14:00 |
| operator 4410 from 08:00 | Rejected with 400: 08:00 is before the latest change, 12:00 |
To record a shift that had several operators, send the first from the start of the shift, then the others in the order they took over.
Operator metrics for the shift are recalculated in the background, so reports may take a moment to show the change.
Errors:
400: no shift matches, orstartis outside the shift, in the future, or before the shift's latest operator change.403: the shift has production marked as reviewed, which locks it.404: the operator does not exist in your company.
Path Parameters
The shift ID.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/v1/shifts/0/operator" \ -H "Content-Type: application/json" \ -d '{ "operatorId": 1063 }'{ "shiftId": 48213, "machineId": 12, "operatorId": 1063, "start": "2026-10-12T10:00:00Z"}Assign operator by time POST
Assign an operator to the shift that machine `machineId` was running at `start`, from `start` on. Use it to record who ran a machine after the fact, for example a day later from a planning system, when you know the machine and the time but not the shift id (`GET /v1/shifts` lists the ids). For a live shift at a floor terminal, `POST /v1/realtime/{machine_id}/operator` is the shorter call. **How operator assignments add up.** Each shift keeps a timeline of who ran the machine. An assignment means "from `start` on, this operator runs the machine": it lasts until the end of the shift, or until the next assignment. * **First assignment.** If nobody is assigned to the shift yet, the operator covers the **whole shift**, from its first minute, even when `start` is later. * **Later assignments.** Each one splits the timeline at `start`: whoever held the machine keeps it until `start`, and the new operator takes it from `start` to the end of the shift. * **Order matters.** Send assignments in chronological order. A `start` earlier than the shift's latest change is rejected with `400`, so you cannot insert an operator in the middle afterwards. A `start` equal to the latest change replaces the operator who took over then. * **Retries are safe.** Sending the same assignment again changes nothing. * `start` is rounded down to the minute. For example, for a `Morning` shift from 06:00 to 14:00 with nobody assigned yet: | Request | Timeline after it | | --- | --- | | operator 1063 from 10:00 | 1063 06:00–14:00 (the first assignment covers the whole shift) | | operator 2071 from 10:00 | 1063 06:00–10:00, 2071 10:00–14:00 | | operator 3300 from 12:00 | 1063 06:00–10:00, 2071 10:00–12:00, 3300 12:00–14:00 | | operator 4410 from 08:00 | Rejected with `400`: 08:00 is before the latest change, 12:00 | To record a shift that had several operators, send the first from the start of the shift, then the others in the order they took over. Operator metrics for the shift are recalculated in the background, so reports may take a moment to show the change. Errors: * `400`: no shift matches, or `start` is outside the shift, in the future, or before the shift's latest operator change. * `403`: the shift has production marked as reviewed, which locks it. * `404`: the operator does not exist in your company.
Add defects by time POST
Add defective units of a SKU to the shift that machine `machineId` was running at `time`, including shifts that have already ended. Use it when you know the machine and roughly when the defects were found, but not the shift id. **How defects add up.** Unlike operators, defects have no timeline and no order. Each call adds a new defects production log of `quantity` units of the SKU, covering the whole shift, and the shift's Quality and OEE count it in the background. Calls never replace earlier ones: * Sending `quantity: 2` and then `quantity: 3` records 5 defects. * Sending the same request twice records the defects twice, so retry only requests that failed. * To undo a call, delete the log it returned with `DELETE /v1/production-logs/{id}`. To see what a shift already has, list its logs with `POST /v1/production-logs/filters`. Defects are not attributed to any operator, and they can be added to past shifts, including ones whose production was reviewed. The SKU is given by `id` or by `name`; an unknown name creates a new SKU, so check the spelling. Errors: * `400`: no shift matches, the shift has not started yet, or the shift does not have enough production of that SKU to hold the defects. * `404`: `sku.id` is not one of your SKUs.