Skip to main content

Asset Links API

The Asset Links API allows you to define and manage relationships between assets. Two relationship types are supported: parentChild for hierarchical relationships and related for peer associations. Asset links support optional aliases and tags for additional context.

Authorization

All endpoints require a valid JWT token in the Authorization header. Asset link operations enforce Casbin permissions on both linked asset objects.


Creates a new relationship between two assets.

POST /asset-links

Request body

FieldTypeRequiredDescription
fromAssetIdstringYesSource asset ID
fromAssetDatabaseIdstringYesDatabase ID of the source asset
toAssetIdstringYesTarget asset ID
toAssetDatabaseIdstringYesDatabase ID of the target asset
relationshipTypestringYesparentChild or related
assetLinkAliasIdstringNoAlias identifier for the link (only valid for parentChild relationships)
tagsarrayNoArray of tag strings associated with this link

Request body example

{
"fromAssetId": "building-model",
"fromAssetDatabaseId": "architecture-db",
"toAssetId": "floor-plan-3",
"toAssetDatabaseId": "architecture-db",
"relationshipType": "parentChild",
"assetLinkAliasId": "floor-3",
"tags": ["structural", "active"]
}

Response

{
"message": "Asset link created successfully",
"assetLinkId": "link-abc123"
}

Error responses

StatusDescription
400Validation error, duplicate link, or assets not found
403Not authorized (requires permission on both assets)
500Internal server error

Retrieves all relationships for a specific asset, organized by relationship type.

GET /database/{databaseId}/assets/{assetId}/asset-links

Path parameters

ParameterTypeRequiredDescription
databaseIdstringYesDatabase identifier
assetIdstringYesAsset identifier

Query parameters

ParameterTypeRequiredDefaultDescription
childTreeViewbooleanNofalseWhen true, returns children as a recursive tree structure

Response (flat view)

{
"related": [
{
"assetId": "related-asset-1",
"assetName": "Related Model",
"databaseId": "architecture-db",
"assetLinkId": "link-def456",
"assetLinkAliasId": null
}
],
"parents": [
{
"assetId": "parent-building",
"assetName": "Main Building",
"databaseId": "architecture-db",
"assetLinkId": "link-ghi789",
"assetLinkAliasId": "wing-a"
}
],
"children": [
{
"assetId": "child-component",
"assetName": "HVAC System",
"databaseId": "architecture-db",
"assetLinkId": "link-jkl012",
"assetLinkAliasId": "hvac"
}
],
"unauthorizedCounts": {
"related": 0,
"parents": 0,
"children": 1
}
}
Unauthorized counts

The unauthorizedCounts field shows how many linked assets the current user does not have permission to view. This allows the UI to indicate that additional relationships exist without exposing unauthorized data.

Response (tree view)

When childTreeView=true, the children field contains a recursive tree structure:

{
"children": [
{
"assetId": "floor-1",
"assetName": "First Floor",
"databaseId": "architecture-db",
"assetLinkId": "link-abc",
"assetLinkAliasId": "floor-1",
"children": [
{
"assetId": "room-101",
"assetName": "Conference Room A",
"databaseId": "architecture-db",
"assetLinkId": "link-def",
"assetLinkAliasId": null,
"children": []
}
]
}
]
}

Retrieves details for a specific asset link.

GET /asset-links/single/{assetLinkId}

Path parameters

ParameterTypeRequiredDescription
assetLinkIdstringYesAsset link identifier

Response

{
"assetLink": {
"assetLinkId": "link-abc123",
"fromAssetId": "building-model",
"fromAssetDatabaseId": "architecture-db",
"toAssetId": "floor-plan-3",
"toAssetDatabaseId": "architecture-db",
"relationshipType": "parentChild",
"assetLinkAliasId": "floor-3",
"tags": ["structural", "active"]
}
}

Updates the tags or alias of an existing asset link.

PUT /asset-links/{assetLinkId}

Path parameters

ParameterTypeRequiredDescription
assetLinkIdstringYesAsset link identifier

Request body

FieldTypeRequiredDescription
tagsarrayYesUpdated array of tag strings
assetLinkAliasIdstringNoUpdated alias (only for parentChild links; set to empty string to remove)

Request body example

{
"tags": ["structural", "active", "reviewed"],
"assetLinkAliasId": "floor-3-updated"
}

Response

{
"message": "Asset link updated successfully"
}

Error responses

StatusDescription
400Validation error or alias conflict
403Not authorized (requires PUT permission on both linked assets)
404Asset link not found
500Internal server error

Deletes an asset link and all associated metadata.

DELETE /asset-links/{assetLinkId}

Path parameters

ParameterTypeRequiredDescription
assetLinkIdstringYesAsset link identifier to delete
Path parameter name

In the API route, this parameter is named relationId, but it represents the asset link ID.

Response

{
"message": "Asset link deleted successfully"
}

Error responses

StatusDescription
400Invalid parameters or linked assets no longer exist
403Not authorized (requires DELETE permission on both linked assets)
404Asset link not found
500Internal server error

  • Assets API -- Manage the assets that links are associated with
  • Tags API -- Manage tags that can be applied to asset links
  • Authorization API -- Configure permissions for asset link operations
  • Metadata API -- Manage metadata on asset links