Skip to main content

Work orders

The work orders endpoint lists your organisation's work orders with their operations and the jobs run against each. It includes work orders that were imported but never started, which no other endpoint shows, and each operation's conversion from part-count pulses to finished parts.

Field names match what POST /api/v1/jobs takes (wo_number, step_number, part_unique_identifier, part_issue, recipe_version), so an operation plus a machine and a start time is a complete request to clock a job on.

If your organisation doesn't use work orders, the list is empty and every id returns 404.

Permissions​

EndpointMethodRead-only AccessRead-write AccessDescription
/api/v1/work_ordersGET✅✅List work orders
/api/v1/work_orders/:idGET✅✅One work order

GET /api/v1/work_orders​

Required role: read-only or read-write

Query parameters (all optional; list parameters take name[]=A&name[]=B or a single bare value):

  • statuses[]: planned, released, in_progress, completed or cancelled.
  • wo_numbers[]: work order numbers, exactly.
  • part_unique_identifiers[]: part numbers, exactly.
  • machine_foreign_ids[] / machine_display_names[]: work orders a machine is part of: an operation routed to a capability the machine has (which finds orders not yet started), or a job run on it. Matched as on the other endpoints: exactly, archived machines included, an unknown machine a 422.
  • has_jobs: false for work orders with no job run on any operation (never started, whatever their status says); true for those with at least one. Deleted jobs don't count.
  • due_from / due_to: due-date window, ISO8601 dates or timestamps. A bare-date due_to includes that day.
  • offset, limit: paging, at most 500 per call (the default), ordered by creation. When there are more, the X-Next-Offset response header says where the next page starts (absent on the last page), beside X-Total-Count.

Any other parameter returns 422 naming it.

Example request​

The work orders not yet started on one machine:

curl "https://your-org.trackmymachines.app/api/v1/work_orders?machine_foreign_ids[]=MAZA-L1&has_jobs=false" \
-H "Authorization: Bearer YOUR_API_KEY"

Example response​

[
{
"id": "wo_Jd8sK2mQpL0xVn4R",
"wo_number": "WO1820505",
"status": "released",
"part_unique_identifier": "PART123",
"part_issue": "C",
"recipe_version": 1,
"quantity_expected": 40,
"quantity_made": 0,
"quantity_scrapped": 0,
"due_date": "2026-11-06T17:00:00Z",
"started_at": null,
"completed_at": null,
"operations": [
{
"step_number": 30,
"description": "Mill second side",
"time_per_part": 840,
"expected_setup_time": 3600,
"number_of_subops": 2,
"output_parts": 1,
"machine_group": "5-axis",
"quantity_made": 0,
"quantity_scrapped": 0,
"jobs": []
}
]
}
]

Response fields​

  • id: the work order's public id (wo_…), accepted by GET /api/v1/work_orders/:id.
  • wo_number: the work order number.
  • status: planned, released, in_progress, completed or cancelled, as set by your import or in TrackMyMachines.
  • part_unique_identifier, part_issue, recipe_version: the part, its issue and the route version.
  • quantity_expected, quantity_made, quantity_scrapped: the target and what finished jobs have counted.
  • due_date, started_at, completed_at: ISO8601, or null.
  • operations: in operation order, each with:
    • step_number: the operation number.
    • description: what the operation does.
    • time_per_part, expected_setup_time: seconds. time_per_part is the time for one finished part; one sequence takes time_per_part × output_parts.
    • number_of_subops, output_parts: how part-count pulses become parts. One sequence takes number_of_subops pulses and yields output_parts parts, so finished parts = pulses ÷ number_of_subops (rounded down) × output_parts. That is the conversion /jobs applies to part_count.
    • machine_group: the machine capability the operation is routed to, or null.
    • quantity_made, quantity_scrapped: counted on this operation.
    • jobs: the jobs run against the operation, oldest first: id (evt_…, for GET /api/v1/jobs/:id), machine_foreign_id, machine_display_name, from, and to (null while running). Deleted jobs are left out.

GET /api/v1/work_orders/:id​

One work order by its wo_… id, in the same shape as an element of the list. To look one up by its number, use GET /api/v1/work_orders?wo_numbers[]=WO1820505.

Error responses​

  • 404 Not Found — { "error": "WorkOrder not found" }
  • 422 Unprocessable Entity — { "error": "Unknown parameter: colour. GET /work_orders takes: …" }
  • 422 Unprocessable Entity — { "error": "Unknown status: shipped. Statuses are: planned, released, in_progress, completed, cancelled." }
  • 422 Unprocessable Entity — { "error": "no machine with foreign id 'MAZA-L9'" }