List Templates

Retrieves all route templates in the system. Returns the complete list of templates with their step definitions, ordered by creation time. This endpoint accepts no query parameters — it always returns the full set.

Use this endpoint to populate template selection dropdowns when setting up new jobs, or to display a template management dashboard where users can browse, edit, or delete templates.

Request

No request body or query parameters.

Response

200 OK

Returns an array of TemplateRoute objects. If no templates exist, returns an empty array [].

FieldTypeDescription
idstringUnique identifier for the template (prefixed with tmpl_)
namestringHuman-readable template name
stepsTemplateStep[]Ordered array of process step definitions
steps[].namestringStep name
steps[].ordernumberZero-based position in the sequence
steps[].locationstring | undefinedPhysical location for the step, if assigned
steps[].optionalbooleanWhether the step can be skipped during advancement
steps[].dependencyType'physical' | 'preferred' | 'completion_gate'How strictly the step order is enforced
createdAtstringISO 8601 timestamp of when the template was created
updatedAtstringISO 8601 timestamp of the last modification

500 Internal Server Error

Returned if an unhandled error occurs while querying the database.

ConditionMessage
Database read failure"Internal Server Error"

Examples

Request

curl http://localhost:3000/api/templates

Response — Multiple templates

[
  {
    "id": "tmpl_abc123",
    "name": "Standard CNC Machining",
    "steps": [
      {
        "name": "Raw Material Inspection",
        "order": 0,
        "location": "QC Lab",
        "optional": false,
        "dependencyType": "physical"
      },
      {
        "name": "CNC Milling",
        "order": 1,
        "location": "CNC Room",
        "optional": false,
        "dependencyType": "physical"
      },
      {
        "name": "Deburring",
        "order": 2,
        "location": "Finishing Bay",
        "optional": false,
        "dependencyType": "physical"
      },
      {
        "name": "Final Inspection",
        "order": 3,
        "location": "QC Lab",
        "optional": false,
        "dependencyType": "physical"
      }
    ],
    "createdAt": "2024-01-10T09:00:00.000Z",
    "updatedAt": "2024-01-10T09:00:00.000Z"
  },
  {
    "id": "tmpl_def456",
    "name": "Assembly Line A",
    "steps": [
      {
        "name": "Sub-Assembly",
        "order": 0,
        "location": "Bay A",
        "optional": false,
        "dependencyType": "physical"
      },
      {
        "name": "Final Assembly",
        "order": 1,
        "location": "Bay B",
        "optional": false,
        "dependencyType": "physical"
      }
    ],
    "createdAt": "2024-01-12T14:00:00.000Z",
    "updatedAt": "2024-01-15T10:30:00.000Z"
  }
]

Response — No templates

[]

Notes

  • Templates are returned with all their steps fully expanded. There is no summary or abbreviated mode.
  • The optional and dependencyType fields on steps reflect the defaults assigned at creation time (false and "physical" respectively) unless they were explicitly set during an update.
  • This endpoint does not support pagination or filtering. For most deployments, the number of templates is small enough that this is not a concern.