API reference · Assets
POST/api/v1/assets/{id}/relationships

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.

RBAC · asset

Path parameters

idstring <uuid>Required
Asset UUID from assets.asset_id.

Request body

Content type: application/json · schema AssetRelationshipCreateRequest

related_asset_idstring <uuid>Required
Related asset UUID from assets.asset_id.
relationship_typestringRequired
Free-form relationship type. Must be non-empty.
min length 1

Response body

Success response 201 · schema AssetRelationshipResponse

successbooleanRequired
Enum: true
dataobjectRequired
dataobjectRequired
relationship_idstring <uuid>Required
Primary key from asset_relationships.relationship_id.
asset_idstring <uuid>Required
Source asset UUID from asset_relationships.asset_id.
related_asset_idstring <uuid>Required
Related asset UUID from asset_relationships.related_asset_id.
relationship_typestringRequired
Free-form relationship type.
tenantstring <uuid>Required
Tenant UUID from asset_relationships.tenant.
created_atstring <date-time>
Relationship creation timestamp.
asset_tagstring
Related asset tag from joined related_assets, present in list responses.
related_asset_namestring
Related asset name from joined related_assets, present in list responses.
asset_typestring
Related asset type from joined related_assets, present in list responses.
Enum: workstationnetwork_deviceservermobile_deviceprinterunknown
statusstring
Related asset status from joined related_assets, present in list responses.
metaobjectRequired
timestampstring <date-time>Required
Response timestamp generated by createApiResponse/createErrorResponse.
versionstringRequired
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.