Skip to main content

Production status

Where every piece is, right now.

GET /api/v1/integration/production-status

curl -H "X-API-Key: mgi_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
https://your-server/api/v1/integration/production-status

Response

{
"codes": [
{
"barcode": "ABC-001",
"lotQuantity": 4,
"orderRef": "0001",
"status": "IN_PROGRESS",
"quantityDone": 0,
"stages": [
{
"sequence": 1,
"service": "SERVICE_A",
"machineName": "MACHINE 01",
"status": "DONE",
"startedAt": "2026-09-18T11:02:00Z",
"finishedAt": "2026-09-18T11:47:00Z",
"scheduledFor": "2026-09-18T08:00:00Z",
"quantityCompleted": 4,
"quantityInProgress": 0,
"quantityWaiting": 0,
"batchId": 101
},
{
"sequence": 2,
"service": "SERVICE_B",
"machineName": "MACHINE 02",
"status": "PARTIAL",
"startedAt": "2026-09-18T13:20:00Z",
"finishedAt": null,
"scheduledFor": "2026-09-18T13:00:00Z",
"quantityCompleted": 2,
"quantityInProgress": 1,
"quantityWaiting": 1,
"batchId": 102
},
{
"sequence": 3,
"service": "SERVICE_C",
"machineName": "MACHINE 03",
"status": "WAITING",
"startedAt": null,
"finishedAt": null,
"scheduledFor": "2026-09-19T09:00:00Z",
"quantityCompleted": 0,
"quantityInProgress": 0,
"quantityWaiting": 4,
"batchId": null
}
]
}
],
"totalCodes": 1,
"truncated": false,
"daysAfterCompletion": 7,
"serverUtc": "2026-09-18T14:02:11Z"
}

Fields

FieldMeaning
codes[]One entry per barcode you sent
totalCodesHow many came back
truncatedtrue when the code ceiling was reached — filter by orderRef
daysAfterCompletionHow long a finished code keeps appearing
serverUtcServer clock, to compare against yours

Per code:

FieldMeaning
barcodeThe code you sent. Always the lot root, never an internal fraction
lotQuantityQuantity ordered. Immutable — it does not change when a lot is split
statusSummary: the situation of the first stage that has not closed
quantityDoneUnits that completed the whole route
stages[]The route, in order

Per stage:

FieldMeaning
sequencePosition in the route
service · machineNameThe operation and where it runs
startedAtWhen the first unit entered. null if none has
finishedAtFilled only when the whole lot has passed
scheduledForWhen it should have started. Past, and still WAITING, means LATE
quantityCompleted · quantityInProgress · quantityWaitingThe three quantities. They always add up to lotQuantity
batchIdThe physical batch (oven load, glass sheet) the units went through, when there is one

It is a snapshot, not a log

This is the thing to understand before writing any code against it.

The response is the complete current state, not a list of things that happened since you last asked. There is no cursor, no offset, and no acknowledgement to send back.

What follows from that:

  • Overwrite what you had. Do not append, do not merge. The answer already is the whole picture.
  • Missing a cycle costs nothing. Your reader was down for an hour? The next call gives you the current state. Nothing queued up and nothing was lost.
  • Polling is idempotent. Reading twice changes nothing on our side.

A log would have been easier for us to build and much harder for you to consume — you would need to track what you had already seen, and one missed event would leave you permanently wrong. A snapshot cannot drift.

The three quantities

A piece ordered with lotQuantity > 1 can be split across stages — part cut, part still waiting. In the example above, the second stage has 2 done, 1 in the furnace and 1 waiting.

Without the middle one, "in the machine" and "not started yet" would both read as zero progress — which is exactly the question a production planner calls about.

The situations a stage can be in

SituationMeaning
WAITINGNot started, and within its scheduled window
LATENot started, and the scheduled date has passed
IN_PROGRESSUnits in the machine now
PARTIALPart of the lot passed, and the rest is in no machine
DONEFinished
OUTSOURCEDSent to an external supplier
SHIPPEDShipped
CANCELLEDCancelled

LATE and PARTIAL exist as their own names on purpose. Both would otherwise hide behind WAITING, and both are the ones that generate a phone call.

The code is always the one you sent

Whatever you used as barcode is what comes back. We do not translate it, prefix it, or replace it with an internal id.

If a piece was split during production — a lot partly cut, a broken piece replaced — the fractions are consolidated back under the code you know. Our internal identifiers stay internal.

Filtering

ParameterEffectExample
orderRefOnly that order?orderRef=0001
daysAfterCompletionHow many days finished codes keep appearing?daysAfterCompletion=3
codeLimitCeiling on the number of codes returned?codeLimit=500
curl -H "X-API-Key: mgi_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
"https://your-server/api/v1/integration/production-status?orderRef=0001"

Finished codes keep showing up for a few days by design, so that a reader which was down for a cycle does not lose the closing of an order.

When truncated comes back true, you hit the ceiling. Filter by orderRef rather than raising it.

What this does not cover

It reports what the shop floor has recorded. It is not a financial document, not a delivery confirmation, and it does not report anything that happens after shipping.