Database API

Assemblies

Lineups, MCCs and panels. The physical grouping a device sits in.

Contents
GET/db/projects/{pid}/assembliesUnlimited
POST/db/projects/{pid}/assemblies201
POST/db/assemblies/{aid}/branches201
PUT/db/assemblies/{aid}
PATCH/db/assemblies/{aid}/sort
DELETE/db/assemblies/{aid}204
FieldTypeNotes
namestringRequired. The designation on the drawings: SWGR-1, MCC-2B.
descriptionstring
sort_orderintegerDisplay order. Set it in bulk with PATCH …/sort rather than one PUT per row.
parent_assembly_idintegerMakes this a sub-assembly. Omit or null for a top-level lineup.

The listing returns top-level assemblies only, each carrying its equipment, its sub_assemblies (recursively, in the same shape), a by_type breakdown and the four status counts.

Assembly
{
  "id": 881,
  "project_id": 312,
  "name": "SWGR-1",
  "description": "480 V main switchgear",
  "sort_order": 0,
  "parent_assembly_id": null,
  "created_at": "2026-09-01 09:20:11.771043",

  "equipment_count": 20,
  "by_type": [ { "type": "lv_breaker", "label": "LV Breakers", "count": 14 } ],
  "equipment": [ /* top-level devices, each with its own sub_equipment */ ],
  "sub_assemblies": [ /* same shape, recursively */ ],

  "pass_count": 17, "fail_count": 1,
  "incomplete_count": 0, "untested_count": 2
}
/branches creates a lineup's worth of structure in one call

Building a twenty-cubicle switchgear one POST at a time is twenty round trips and twenty chances to get halfway. POST /db/assemblies/{aid}/branches creates the child structure in a single transaction. It either all exists or none of it does.