# Add a SKU to the current shift (https://docs.pulsarml.com/v1/api-reference/realtime/post-realtime-machine_id-sku)

Attach a SKU to the shift the machine is running at the moment of the call.

Built for shop-floor terminals and scanners: no shift lookup and no production-log
arithmetic. The SKU is given as `skuId` or as `sku` (its name), and the work order as
`simpleWorkOrderId` or `simpleWorkOrderName`.

This writes to the live shift and is visible in the Pulsar dashboard immediately.

## `POST /v1/realtime/{machine_id}/sku`

Base URLs:
- `https://draco.prod.pulsarml.com` — Production
- `https://draco.dev.pulsarml.com` — Development (sandbox)

Authentication: send your API key in the `x-api-key` header.

### Path parameters

- `machine_id` (integer, required) — The machine ID.

### Request body (`application/json`, required)

Type: object (`AddSkuToCurrentShiftRequestV1`)

- `simpleWorkOrderId` (string, optional, nullable, e.g. `"123"`) — The id of the simple work order to add the SKU to.
- `simpleWorkOrderName` (string, optional, nullable, e.g. `"WO-001"`) — The name of the simple work order to add the SKU to.
- `skuId` (string, optional, nullable, e.g. `"456"`) — The id of the SKU to add to the machine's current shift.
- `sku` (string, optional, nullable, e.g. `"sku 1"`) — The name of the SKU to add to the machine's current shift.
- `quantity` (number, optional, nullable, e.g. `1000`) — The quantity produced for the SKU.
- `start` (string (date-time), optional, nullable, e.g. `"2024-01-01T08:00:00"`) — The start time of the SKU production within the current shift.
- `end` (string (date-time), optional, nullable, e.g. `"2024-01-01T16:00:00"`) — The end time of the SKU production within the current shift.
- `custom` (object (any keys), optional, nullable) — Custom field values keyed by field id.

### Responses

#### 204 — Successful Response

#### 422 — Validation Error

Type: object (`HTTPValidationError`)

- `detail` (array of object, optional)
  - `loc` (array of string | integer, required)
  - `msg` (string, required)
  - `type` (string, required)

### Example request

```bash
curl -X POST 'https://draco.prod.pulsarml.com/v1/realtime/<machine_id>/sku' \
  -H 'x-api-key: <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "simpleWorkOrderId": "123",
    "simpleWorkOrderName": "WO-001",
    "skuId": "456",
    "sku": "sku 1",
    "quantity": 1000,
    "start": "2024-01-01T08:00:00",
    "end": "2024-01-01T16:00:00",
    "custom": {
      "fieldId": "value"
    }
  }'
```