API Reference (v2)UnitsSub-units
Add sub-unit
Add a sub-unit to a parent unit to track component assemblies and multi-level hardware traceability.
PUT
/v2/units/{serial_number}/childrenAuthorizationBearer <token>
API key for authentication. Use format: Bearer YOUR_API_KEY
In: header
Path Parameters
serial_numberstring
Serial number of the parent unit
child_serial_numberstring
Serial number of the sub-unit to add
Length
1 <= length <= 60Response Body
from tofupilot.v2 import TofuPilot
# Initialize the TofuPilot client
client = TofuPilot()
# Execute the operation
result = client.units.add_child(
serial_number="string",
child_serial_number="SUB-001"
)
# Handle response
print(result){
"id": "550e8400-e29b-41d4-a716-446655440000"
}{
"message": "Bad request",
"code": "BAD_REQUEST",
"issues": []
}{
"message": "Unauthorized",
"code": "UNAUTHORIZED",
"issues": []
}{
"message": "Not found",
"code": "NOT_FOUND",
"issues": []
}{
"message": "Internal server error",
"code": "INTERNAL_SERVER_ERROR",
"issues": []
}How is this guide?
Delete unit attachments DELETE
Delete attachments from a unit by their IDs. Removes the files from storage and unlinks them from the unit.
Remove sub-unit DELETE
Remove a sub-unit relationship from a parent unit by serial number. Only unlinks the parent-child relationship; neither unit is deleted from the system.