Database API

Equipment

The devices themselves, nameplate data and where they live.

Contents
GET/db/projects/{pid}/all-equipmentUnlimited
GET/db/assemblies/{aid}/equipment
POST/db/assemblies/{aid}/equipment201
POST/db/equipment/{eid}/sub201
GET/db/equipment/{eid}
PUT/db/equipment/{eid}
PATCH/db/equipment/{eid}/sort
PATCH/db/equipment/{eid}/move
GET/db/equipment/{eid}/forms
DELETE/db/equipment/{eid}204
FieldTypeNotes
device_typestringRequired. One of the twelve database slugs.
designationstringRequired. The tag: 52-1, T-3.
manufacturer, model, serial_numberstringNameplate. Copied onto the report.
voltage_rating, amp_ratingstringStrings, not numbers: "480V", "15kV", "2000A".
notesstring
sort_orderinteger
parent_equipment_idintegerMakes this sub-equipment. Prefer POST …/sub.

Each device is returned with a denormalised substation (its assembly's name) and the state of its most recent test, so a device list renders without a second query per row.

Equipment
{
  "id": 5541,
  "assembly_id": 881,
  "device_type": "lv_breaker",
  "designation": "52-1",
  "manufacturer": "Square D",
  "model": "MasterPact NW20H",
  "serial_number": "SD-2210-4471",
  "voltage_rating": "480V",
  "amp_rating": "2000A",
  "notes": "",
  "sort_order": 0,
  "parent_equipment_id": null,
  "substation": "SWGR-1",        the parent assembly's name
  "created_at": "2026-09-01 09:31:40.229517",

  "record_count": 2,
  "last_tested": "2026-09-04",      null when never tested
  "last_status": "pass",
  "sub_equipment": [ /* same shape, recursively */ ]
}

Moving a device#

A breaker that turns out to be in a different cubicle is re-parented rather than deleted and recreated. That keeps its id and, more importantly, its test history.

curl
curl -X PATCH "$BASE/db/equipment/5541/move" \
  -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"assembly_id": 902}'

Available forms#

GET /db/equipment/{eid}/forms returns the form types valid for that device's device_type. Use it to populate a picker rather than mapping the twelve slugs yourself. The mapping is the backend's and will change with the forms.