API reference · AssetsPOST /api/v1/assets/{id}/relationships
Product availability AlgaPSA
Create asset relationship Creates a relationship row between the path asset ID and related_asset_id for the authenticated tenant. The request body requires related_asset_id and non-empty relationship_type. The service rejects self relationships and duplicate source/related pairs, but currently throws generic Errors for those cases, which surface as 500 rather than 400 or 409. The inserted row is returned without joined related asset details. In the current v1 asset route wiring, req.context may be absent because no route-level API-key auth wrapper sets it, causing a 500 before insert.
Path parameters id string <uuid> Required
Asset UUID from assets.asset_id.
Request body Content type: application/json · schema AssetRelationshipCreateRequest
related_asset_id string <uuid> Required
Related asset UUID from assets.asset_id.
relationship_type string Required
Free-form relationship type. Must be non-empty.
min length 1
Response body Success response 201 · schema AssetRelationshipResponse
success boolean Required
Enum: true
relationship_id string <uuid> Required
Primary key from asset_relationships.relationship_id.
asset_id string <uuid> Required
Source asset UUID from asset_relationships.asset_id.
related_asset_id string <uuid> Required
Related asset UUID from asset_relationships.related_asset_id.
relationship_type string Required
Free-form relationship type.
tenant string <uuid> Required
Tenant UUID from asset_relationships.tenant.
created_at string <date-time>
Relationship creation timestamp.
asset_tag string
Related asset tag from joined related_assets, present in list responses.
related_asset_name string
Related asset name from joined related_assets, present in list responses.
asset_type string
Related asset type from joined related_assets, present in list responses.
Enum: workstationnetwork_deviceservermobile_deviceprinterunknown
status string
Related asset status from joined related_assets, present in list responses.
timestamp string <date-time> Required
Response timestamp generated by createApiResponse/createErrorResponse.
version string Required
API response version string.
Response codes 201
Asset relationship created successfully.
400
Request body validation failed or a database reference is invalid.
401
x-api-key is missing at middleware.
403
Authenticated request context lacks permission to update asset relationships when auth wiring is present.
409
Intended duplicate conflict response; current duplicate check throws a generic Error that may surface as 500.
500
Unexpected error, including missing req.context, self-relationship errors, or duplicate relationship errors in the current implementation.