Skip to main content

Relationships API

The Relationships API manages parent-child and other typed relationships between items. Relationships form the Bill of Materials (BOM) structure and traceability links in Cascadia PLM.

Endpoints Overview​

MethodEndpointDescription
GET/api/relationshipsList relationships for a design
GET/api/items/:id/relationshipsList relationships for an item
POST/api/items/:id/relationshipsCreate a relationship
PUT/api/relationships/:relationshipIdUpdate relationship properties
DELETE/api/relationships/:relationshipIdDelete a relationship
POST/api/relationships/batch-createBatch create relationships

List Relationships by Design​

GET /api/relationships

Returns all relationships for items within a design. Auth required.

Query Parameters​

ParameterTypeRequiredDescription
designIdUUIDYesDesign to scope relationships
typestringNoFilter by relationship type (e.g., bom, reference)

Response​

{
"data": {
"relationships": [
{
"id": "rel-uuid",
"sourceId": "parent-item-uuid",
"targetId": "child-item-uuid",
"relationshipType": "bom"
}
]
}
}

List Relationships for an Item​

GET /api/items/:id/relationships

Returns all relationships where the item is the source (parent). Supports branch-aware queries.

Query Parameters​

ParameterTypeRequiredDescription
typestringNoFilter by relationship type
branchUUIDNoBranch ID for version-aware relationships

Response​

Relationships include full details of both source and target items:

{
"data": {
"relationships": [
{
"id": "rel-uuid",
"sourceId": "parent-uuid",
"targetId": "child-uuid",
"relationshipType": "bom",
"quantity": 4,
"findNumber": 1,
"referenceDesignator": "R1,R2,R3,R4",
"sourceItem": {
"id": "parent-uuid",
"itemNumber": "ASM-001",
"name": "Main Assembly"
},
"targetItem": {
"id": "child-uuid",
"itemNumber": "PRT-003",
"name": "Resistor 10K"
}
}
]
}
}

Example​

# Get BOM children for an assembly
curl /api/items/PARENT_UUID/relationships?type=bom

# Get branch-specific BOM
curl /api/items/PARENT_UUID/relationships?type=bom&branch=BRANCH_UUID

Create Relationship​

POST /api/items/:id/relationships

Creates a new relationship from the specified item (source) to a target item. Auth required.

Request Body​

FieldTypeRequiredDescription
targetIdUUIDYesTarget (child) item ID
relationshipTypestringYesRelationship type (e.g., bom, reference, derived)
quantitynumberNoQuantity of child in parent (BOM)
findNumberintegerNoFind number for BOM ordering
referenceDesignatorstringNoReference designator(s), comma-separated

Example​

curl -X POST /api/items/PARENT_UUID/relationships \
-H "Content-Type: application/json" \
-d '{
"targetId": "child-item-uuid",
"relationshipType": "bom",
"quantity": 4,
"findNumber": 1,
"referenceDesignator": "R1,R2,R3,R4"
}'

Response​

Status: 201 Created

{
"data": {
"success": true
}
}

Update Relationship​

PUT /api/relationships/:relationshipId

Updates relationship properties. Auth required.

Request Body​

All fields are optional:

FieldTypeDescription
quantitynumberUpdated quantity
findNumberintegerUpdated find number
referenceDesignatorstringUpdated reference designator(s)

Example​

curl -X PUT /api/relationships/REL_UUID \
-H "Content-Type: application/json" \
-d '{
"quantity": 6,
"referenceDesignator": "R1,R2,R3,R4,R5,R6"
}'

Response​

{
"data": {
"relationship": {
"id": "rel-uuid",
"sourceId": "parent-uuid",
"targetId": "child-uuid",
"relationshipType": "bom",
"quantity": "6",
"findNumber": 1,
"referenceDesignator": "R1,R2,R3,R4,R5,R6"
}
}
}

Delete Relationship​

DELETE /api/relationships/:relationshipId

Removes a relationship. Auth required.

Response​

{
"data": {
"success": true,
"message": "Relationship deleted successfully"
}
}

Batch Create Relationships​

POST /api/relationships/batch-create

Create multiple relationships in a single request. Limited to 500 relationships per batch. Supports optional replacement of existing relationships.

Request Body​

FieldTypeRequiredDescription
relationshipsarrayYesArray of relationship objects
replaceExistingbooleanNoIf true, delete existing relationships of the same type for each source before creating

Each relationship object:

FieldTypeRequiredDescription
sourceIdUUIDYesSource (parent) item ID
targetIdUUIDYesTarget (child) item ID
relationshipTypestringYesRelationship type
quantitynumberNoQuantity
referenceDesignatorstringNoReference designator(s)
findNumberintegerNoFind number
metadataobjectNoArbitrary metadata

Example​

curl -X POST /api/relationships/batch-create \
-H "Content-Type: application/json" \
-d '{
"relationships": [
{
"sourceId": "asm-uuid",
"targetId": "prt-001-uuid",
"relationshipType": "bom",
"quantity": 2,
"findNumber": 1
},
{
"sourceId": "asm-uuid",
"targetId": "prt-002-uuid",
"relationshipType": "bom",
"quantity": 1,
"findNumber": 2
}
],
"replaceExisting": true
}'

Response​

Returns 201 (all succeeded), 207 (partial success), or 400 (all failed):

{
"data": {
"created": 2,
"skipped": 0,
"errors": []
}
}

With partial failures:

{
"data": {
"created": 1,
"skipped": 0,
"errors": [
{
"relationship": {
"sourceId": "asm-uuid",
"targetId": "invalid-uuid",
"relationshipType": "bom"
},
"error": "Failed to create relationship",
"details": "Foreign key constraint violation"
}
]
}
}

Behavior Notes​

  • Duplicate detection: If replaceExisting is false (default), existing relationships with the same source/target/type are skipped (counted in skipped).
  • Replace mode: If replaceExisting is true, all existing relationships of the same type for each unique source ID are deleted before creating new ones. This is useful for rebuilding a BOM.
  • Cycle detection: Creating a relationship that would form a circular reference results in a 422 error with code ITEM_RELATIONSHIP_CYCLE.

Relationship Types​

TypeDescriptionTypical Use
bomBill of Materials parent-childAssembly to component
referenceReference/traceability linkRequirement to part
derivedDerived-from relationshipNew revision from old
cross_referenceCross-design referenceLibrary part usage

Where-Used Queries​

To find all items that use a specific item (reverse BOM lookup), query relationships where the item is the target:

# Get all assemblies containing part PRT-001
curl /api/items/PRT_001_UUID/relationships?type=bom

Note: The current API returns relationships where the item is the source. For true where-used (item as target), use the item graph endpoint:

GET /api/items/:id/graph