Set shift targets

Set the production target of existing shifts, for upcoming or past days. The body is a JSON array of up to 1,000 rows, so a whole plan (or a CSV export of one) fits in one call.

Each row names a shift by its machine (uuid or name), the date it starts on in the company's timezone, and its title (for example Morning). Sending the same values again is harmless: the target is overwritten, not added to.

Every row comes back with a status, and only updated rows changed anything:

  • updated: the shift's target is now targetQuantity.
  • machineNotFound / ambiguousMachine: no machine, or more than one, matches machine.
  • shiftNotFound / ambiguousShift: the machine has no shift, or more than one, with that title starting on that date.
  • duplicateShift: another row in the same request points at the same shift, so neither was applied.

Targets are read live from the shift, so realtime and shift views show the new value right away. Nothing is recalculated: the target is not an input to OEE.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Itemsitems <= 1000
[index: integer]?

Response Body

application/json

application/json

Try it live
PUT
/v1/shifts/targets

This endpoint requires authentication — paste a token in the Authorization section below.

curl -X PUT "https://example.com/v1/shifts/targets" \  -H "Content-Type: application/json" \  -d '[    {      "machine": {},      "date": "2026-10-12",      "title": "Morning",      "targetQuantity": 1200    }  ]'
[  {    "machine": {      "uuid": "0190c1c2-7a3e-7cc1-9b2f-1d2e3f4a5b6c",      "name": "Line 1"    },    "date": "2026-10-12",    "title": "Morning",    "targetQuantity": 1200,    "status": "updated",    "machineId": 12,    "shiftId": 48213  }]

List shifts GET

List your shifts that overlap a time range, past or upcoming, to find the `id` that `POST /v1/shifts/{shift_id}/operator` and `POST /v1/shifts/{shift_id}/defects` take. A shift is returned when any part of it falls between `from` and `to`: it ends after `from` and starts before `to`. So a night shift from 22:00 to 06:00 shows up in a range covering either day. The range may span at most **31 days**; page through longer periods with consecutive ranges. Shifts come back ordered by `start`, then by machine. Narrow the list with `machineId`, repeated for several machines: ``` GET /v1/shifts?from=2026-10-12T00:00:00Z&to=2026-10-13T00:00:00Z&machineId=12 ``` Shifts excluded from metrics are listed too, with `isConsidered: false`.

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.