# LitmusEdgeManager 2.31.x API Documentation/Digital Twins/Asset Management - LE, LEM, LUNS API Docs

## DigitalTwin Model Details

**GET** `{{LEM_URL}}/api/v1/dt2/model/{{LEM_DT_Model_ID}}`

# DigitalTwin Model Details

Returns the top-level fields for one model. Same shape as one entry of `Get DigitalTwin Models` but addressed by model ID instead of company name.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/dt2/model/{{LEM_DT_Model_ID}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Path parameters

| Location | Name                       | Required | Description                                  |
|----------|----------------------------|----------|----------------------------------------------|
| Path     | `{{LEM_DT_Model_ID}}`      | Yes      | Model UUID.                                  |

## Response

`200 OK` -- `application/json`. See `Get DigitalTwin Models` for the field reference.

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```Text
{
    "hasImage": true,
    "ID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
    "Name": "PlantModel",
    "CompanyName": "solutions",
    "Description": "",
    "Assets": "ASSET",
    "ImagePreviewUrl": "https://10.17.10.247:443/api/v1/image/dt2-model-image-preview-2f00a759-96d8-4b2c-acd6-6861542f65b2",
    "ImageUrl": "https://10.17.10.247:443/api/v1/image/dt2-model-image-2f00a759-96d8-4b2c-acd6-6861542f65b2",
    "RootNodeID": "5fdfd55f-38ff-4406-ab57-9c41c8f92ab6",
    "Version": 0
}
```

---

## DigitalTwin Model Static Attributes

**GET** `{{LEM_URL}}/api/v1/dt2/static-attributes/{{LEM_DT_Model_ID}}`

# DigitalTwin Model Static Attributes

Returns the static (constant) attributes attached to one model. Each attribute is a typed key/value pair.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/dt2/static-attributes/{{LEM_DT_Model_ID}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Response

`200 OK` -- `application/json`

| Field           | Type    | Description                                                                                |
|-----------------|---------|--------------------------------------------------------------------------------------------|
| `ID`            | string  | Attribute UUID.                                                                            |
| `ModelID`       | string  | Parent model UUID.                                                                         |
| `InstanceID`    | string  | `null` for model-level attributes; UUID for per-instance overrides (not applicable at LEM scope). |
| `Key`           | string  | Attribute name (e.g. `Manufacturer`).                                                       |
| `Value`         | string  | Attribute value.                                                                           |

```json
[
  { "ID": "362e4c6c-f3ba-4e55-b759-0d07c18b1879", "ModelID": "2f00a759-...", "InstanceID": null, "Key": "Type",     "Value": "Manufacturing" },
  { "ID": "6f4374ad-ec7a-40a4-8dcd-89cce0bf8943", "ModelID": "2f00a759-...", "InstanceID": null, "Key": "Location", "Value": "Los Angeles, CA, USA" }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```Text
[
    {
        "ID": "362e4c6c-f3ba-4e55-b759-0d07c18b1879",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "Key": "Type",
        "Value": "Manufacturing"
    },
    {
        "ID": "6f4374ad-ec7a-40a4-8dcd-89cce0bf8943",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "Key": "Location",
        "Value": "Los Angeles, CA, USA"
    },
    {
        "ID": "f11c264c-c206-4070-bb97-fcf6cd707562",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "Key": "Plant Code",
        "Value": " "
    },
    {
        "ID": "f30b7800-c644-4161-83e8-7791f822ff3f",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "Key": "Business Group",
        "Value": "Automotive"
    }
]
```

---

## DigitalTwin Dynamic Attributes

**GET** `{{LEM_URL}}/api/v1/dt2/dynamic-attributes/{{LEM_DT_Model_ID}}`

# DigitalTwin Dynamic Attributes

Returns the dynamic (live-signal) attributes attached to one model. Each dynamic attribute carries name, data type, unit, and an optional topic + transformation schema binding.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/dt2/dynamic-attributes/{{LEM_DT_Model_ID}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Response

`200 OK` -- `application/json`

| Field              | Type    | Description                                                                                |
|--------------------|---------|--------------------------------------------------------------------------------------------|
| `ID`               | string  | Attribute UUID.                                                                            |
| `Name`             | string  | Attribute name.                                                                            |
| `DataType`         | string  | OPC UA-style type (`int`, `float`, `bool`, ...). Empty for unspecified.                    |
| `Unit`             | string  | Engineering unit.                                                                          |
| `ModelID`          | string  | Parent model.                                                                              |
| `InstanceID`       | string  | `null` at LEM scope.                                                                       |
| `SchemaID`         | string  | UUID of an attached transformation, or `null`.                                              |
| `Topic`            | string  | Source MQTT topic when the attribute is bound to a live data source.                       |
| `SkipParentKey`    | boolean | If `true`, omit the parent hierarchy node's name from the published payload key.            |

```json
[
  {
    "ID": "2583268f-4816-4fce-9769-c5db7a781987",
    "Name": "Equipment_7",
    "DataType": "",
    "Unit": "",
    "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
    "InstanceID": null,
    "SchemaID": null,
    "Topic": "",
    "SkipParentKey": false
  }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```Text
[
    {
        "ID": "2583268f-4816-4fce-9769-c5db7a781987",
        "Name": "Equipment_7",
        "DataType": "",
        "Unit": "",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "SchemaID": null,
        "Topic": "",
        "SkipParentKey": false
    },
    {
        "ID": "4440a44d-8947-4d03-8c12-3f4a7d72f269",
        "Name": "Equipment_3",
        "DataType": "",
        "Unit": "",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "SchemaID": null,
        "Topic": "",
        "SkipParentKey": false
    },
    {
        "ID": "674bc555-f4b8-4cb3-8fcf-5564ebd439f3",
        "Name": "Equipment_4",
        "DataType": "",
        "Unit": "",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "SchemaID": null,
        "Topic": "",
        "SkipParentKey": false
    },
    {
        "ID": "80f8ce9b-14fa-4612-9166-c4fa890e02cb",
        "Name": "Equipment_2",
        "DataType": "",
        "Unit": "",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "SchemaID": null,
        "Topic": "",
        "SkipParentKey": false
    },
    {
        "ID": "87099aba-6d49-4d32-947e-9ab3f59bb434",
        "Name": "Equipment_1",
        "DataType": "",
        "Unit": "",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "SchemaID": null,
        "Topic": "",
        "SkipParentKey": false
    },
    {
        "ID": "a4ac30fe-a5d1-4e6d-94e6-42ddba583d66",
        "Name": "Equipment_6",
        "DataType": "",
        "Unit": "",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "SchemaID": null,
        "Topic": "",
        "SkipParentKey": false
    },
    {
        "ID": "fc1d0f09-b090-431e-9dbc-796cb4edac92",
        "Name": "Equipment_5",
        "DataType": "",
        "Unit": "",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "InstanceID": null,
        "SchemaID": null,
        "Topic": "",
        "SkipParentKey": false
    }
]
```

---

## DigitalTwin Transformations

**GET** `{{LEM_URL}}/api/v1/dt2/transformations/{{LEM_DT_Model_ID}}`

# DigitalTwin Transformations

Returns the transformations (named JSON Schemas) defined for one model. Dynamic attributes reference transformations via their `SchemaID` to validate / shape payloads before publishing.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/dt2/transformations/{{LEM_DT_Model_ID}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Response

`200 OK` -- `application/json`

| Field           | Type    | Description                                                                                |
|-----------------|---------|--------------------------------------------------------------------------------------------|
| `ID`            | string  | Transformation UUID. Used as `SchemaID` from dynamic attributes.                            |
| `Name`          | string  | Display name.                                                                              |
| `ModelID`       | string  | Parent model.                                                                              |
| `Schema`        | string  | JSON Schema (or JSONPath mapping) as a string. Decode client-side.                          |
| `SchemaType`    | string  | `json` for JSON Schema, other values reserved.                                              |

```json
[
  { "ID": "28099054-40b7-4fa4-930d-5696779f628c", "Name": "plant", "ModelID": "2f00a759-...", "Schema": "{\"plant\":\"$.metadata.plant\"}", "SchemaType": "json" }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```Text
[
    {
        "ID": "28099054-40b7-4fa4-930d-5696779f628c",
        "Name": "plant",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "Schema": "{\"plant\":\"$.metadata.plant\"}",
        "SchemaType": "json"
    },
    {
        "ID": "776eab7e-caa0-4ee3-b28d-6add7197b8a3",
        "Name": "OEE",
        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "Schema": "{\"OEE\":\"$.OEE\"}",
        "SchemaType": "json"
    }
]
```

---

## DigitalTwin Get Heirarchy

**GET** `{{LEM_URL}}/api/v1/dt2/model/node/{{LEM_DT_Model_RootNodeID}}`

# DigitalTwin Get Hierarchy

Returns the full hierarchical node tree for one model, starting at the root node. Each node carries an `Object` reference and an array of `ChildNodes`.

Despite the Postman name's misspelling ("Heirarchy"), the underlying field is `Hierarchy`. The path takes the **root node ID** (not the model ID): obtain it from `Get DigitalTwin Models > RootNodeID`.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/dt2/model/node/{{LEM_DT_Model_RootNodeID}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Path parameters

| Location | Name                                | Required | Description                                  |
|----------|-------------------------------------|----------|----------------------------------------------|
| Path     | `{{LEM_DT_Model_RootNodeID}}`       | Yes      | Root node UUID (from `RootNodeID`).           |

## Response

`200 OK` -- `application/json`

| Field            | Type    | Description                                                                                |
|------------------|---------|--------------------------------------------------------------------------------------------|
| `ID`             | string  | Node UUID.                                                                                 |
| `Name`           | string  | Node display name.                                                                         |
| `NodeType`       | string  | `MODEL`, `FOLDER`, `STATIC_ATTRIBUTE`, `DYNAMIC_ATTRIBUTE`.                                |
| `Object`         | object  | Embedded entity record (the model itself for the root; an attribute / folder for children). |
| `ChildNodes`     | object[]| Recursive nested nodes.                                                                    |

```json
{
  "ID": "5fdfd55f-38ff-4406-ab57-9c41c8f92ab6",
  "Name": "root",
  "Object": {
    "hasImage": true,
    "ID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
    "Name": "PlantModel",
    "CompanyName": "solutions",
    "Description": "",
    "Assets": "ASSET",
    "RootNodeID": "5fdfd55f-38ff-4406-ab57-9c41c8f92ab6",
    "Version": 1
  },
  "NodeType": "MODEL",
  "ChildNodes": [
    {
      "ID": "cd9f0df5-88f9-415e-8ffc-31067ea59461",
      "Name": "Plant",
      "Object": {}
    }
  ]
}
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```Text
{
    "ID": "5fdfd55f-38ff-4406-ab57-9c41c8f92ab6",
    "Name": "root",
    "Object": {
        "hasImage": true,
        "ID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
        "Name": "PlantModel",
        "CompanyName": "solutions",
        "Description": "",
        "Assets": "ASSET",
        "ImagePreviewUrl": null,
        "ImageUrl": null,
        "RootNodeID": "5fdfd55f-38ff-4406-ab57-9c41c8f92ab6",
        "Version": 1
    },
    "NodeType": "MODEL",
    "ChildNodes": [
        {
            "ID": "cd9f0df5-88f9-415e-8ffc-31067ea59461",
            "Name": "Plant",
            "Object": null,
            "NodeType": "FOLDER",
            "ChildNodes": [
                {
                    "ID": "aa5f0924-e7c3-4182-a3b6-cd06d890f81a",
                    "Name": "Area_1",
                    "Object": null,
                    "NodeType": "FOLDER",
                    "ChildNodes": [
                        {
                            "ID": "20cb18cd-1b26-45df-bb46-70e77d664f3e",
                            "Name": "Line_1",
                            "Object": null,
                            "NodeType": "FOLDER",
                            "ChildNodes": [
                                {
                                    "ID": "d1418fae-dd3c-41fb-9fdf-29c047b1edf5",
                                    "Name": "Equipment",
                                    "Object": null,
                                    "NodeType": "FOLDER",
                                    "ChildNodes": [
                                        {
                                            "ID": "73e24a5e-9b0d-42a0-a0e8-cd073bf22902",
                                            "Name": "Equipment_1",
                                            "Object": {
                                                "ID": "87099aba-6d49-4d32-947e-9ab3f59bb434",
                                                "Name": "Equipment_1",
                                                "DataType": "",
                                                "Unit": "",
                                                "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                                                "InstanceID": null,
                                                "SchemaID": null,
                                                "Topic": "",
                                                "SkipParentKey": false
                                            },
                                            "NodeType": "DYNAMIC_ATTRIBUTE",
                                            "ChildNodes": [],
                                            "CompanyName": null,
                                            "Position": 0
                                        },
                                        {
                                            "ID": "b724b712-b39b-4906-a69b-e35befe75a01",
                                            "Name": "Equipment_2",
                                            "Object": {
                                                "ID": "80f8ce9b-14fa-4612-9166-c4fa890e02cb",
                                                "Name": "Equipment_2",
                                                "DataType": "",
                                                "Unit": "",
                                                "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                                                "InstanceID": null,
                                                "SchemaID": null,
                                                "Topic": "",
                                                "SkipParentKey": false
                                            },
                                            "NodeType": "DYNAMIC_ATTRIBUTE",
                                            "ChildNodes": [],
                                            "CompanyName": null,
                                            "Position": 1
                                        }
                                    ],
                                    "CompanyName": null,
                                    "Position": 0
                                }
                            ],
                            "CompanyName": null,
                            "Position": 0
                        },
                        {
                            "ID": "6ec2d6c9-0658-4ccc-bdcb-f873ddc45c6e",
                            "Name": "Line_2",
                            "Object": null,
                            "NodeType": "FOLDER",
                            "ChildNodes": [
                                {
                                    "ID": "9796a912-547b-4461-8570-8e2f26d77751",
                                    "Name": "Equipment",
                                    "Object": null,
                                    "NodeType": "FOLDER",
                                    "ChildNodes": [
                                        {
                                            "ID": "b950f2cf-054e-40ea-a8d6-2aa62c99e93a",
                                            "Name": "Equipment_3",
                                            "Object": {
                                                "ID": "4440a44d-8947-4d03-8c12-3f4a7d72f269",
                                                "Name": "Equipment_3",
                                                "DataType": "",
                                                "Unit": "",
                                                "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                                                "InstanceID": null,
                                                "SchemaID": null,
                                                "Topic": "",
                                                "SkipParentKey": false
                                            },
                                            "NodeType": "DYNAMIC_ATTRIBUTE",
                                            "ChildNodes": [],
                                            "CompanyName": null,
                                            "Position": 0
                                        },
                                        {
                                            "ID": "5f797d31-3c48-45e9-b5f5-686a4aa87267",
                                            "Name": "Equipment_4",
                                            "Object": {
                                                "ID": "674bc555-f4b8-4cb3-8fcf-5564ebd439f3",
                                                "Name": "Equipment_4",
                                                "DataType": "",
                                                "Unit": "",
                                                "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                                                "InstanceID": null,
                                                "SchemaID": null,
                                                "Topic": "",
                                                "SkipParentKey": false
                                            },
                                            "NodeType": "DYNAMIC_ATTRIBUTE",
                                            "ChildNodes": [],
                                            "CompanyName": null,
                                            "Position": 1
                                        }
                                    ],
                                    "CompanyName": null,
                                    "Position": 0
                                }
                            ],
                            "CompanyName": null,
                            "Position": 1
                        }
                    ],
                    "CompanyName": null,
                    "Position": 0
                },
                {
                    "ID": "b46e88b5-141e-40c2-9219-4bb260801624",
                    "Name": "Area_2",
                    "Object": null,
                    "NodeType": "FOLDER",
                    "ChildNodes": [
                        {
                            "ID": "06c8ba1e-97d4-48ee-a954-34b08c7cd1da",
                            "Name": "Line_1",
                            "Object": null,
                            "NodeType": "FOLDER",
                            "ChildNodes": [
                                {
                                    "ID": "f3a30960-5a82-4970-94c6-ae5b535b9774",
                                    "Name": "Equipment",
                                    "Object": null,
                                    "NodeType": "FOLDER",
                                    "ChildNodes": [
                                        {
                                            "ID": "812d1584-5ee9-4df5-97a6-d034cc711151",
                                            "Name": "Equipment_5",
                                            "Object": {
                                                "ID": "fc1d0f09-b090-431e-9dbc-796cb4edac92",
                                                "Name": "Equipment_5",
                                                "DataType": "",
                                                "Unit": "",
                                                "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                                                "InstanceID": null,
                                                "SchemaID": null,
                                                "Topic": "",
                                                "SkipParentKey": false
                                            },
                                            "NodeType": "DYNAMIC_ATTRIBUTE",
                                            "ChildNodes": [],
                                            "CompanyName": null,
                                            "Position": 0
                                        }
                                    ],
                                    "CompanyName": null,
                                    "Position": 0
                                }
                            ],
                            "CompanyName": null,
                            "Position": 0
                        },
                        {
                            "ID": "a7992c75-d485-46e9-9626-cedc8482b8a3",
                            "Name": "Line_2",
                            "Object": null,
                            "NodeType": "FOLDER",
                            "ChildNodes": [
                                {
                                    "ID": "24dda06e-808f-439f-8fcd-4249cc580ee6",
                                    "Name": "Equipment",
                                    "Object": null,
                                    "NodeType": "FOLDER",
                                    "ChildNodes": [
                                        {
                                            "ID": "0b3e9d27-32b6-497f-abe6-f973cb043a07",
                                            "Name": "Equipment_6",
                                            "Object": {
                                                "ID": "a4ac30fe-a5d1-4e6d-94e6-42ddba583d66",
                                                "Name": "Equipment_6",
                                                "DataType": "",
                                                "Unit": "",
                                                "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                                                "InstanceID": null,
                                                "SchemaID": null,
                                                "Topic": "",
                                                "SkipParentKey": false
                                            },
                                            "NodeType": "DYNAMIC_ATTRIBUTE",
                                            "ChildNodes": [],
                                            "CompanyName": null,
                                            "Position": 0
                                        },
                                        {
                                            "ID": "ad070e43-67db-4ffa-b92a-a4510975914e",
                                            "Name": "Equipment_7",
                                            "Object": {
                                                "ID": "2583268f-4816-4fce-9769-c5db7a781987",
                                                "Name": "Equipment_7",
                                                "DataType": "",
                                                "Unit": "",
                                                "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                                                "InstanceID": null,
                                                "SchemaID": null,
                                                "Topic": "",
                                                "SkipParentKey": false
                                            },
                                            "NodeType": "DYNAMIC_ATTRIBUTE",
                                            "ChildNodes": [],
                                            "CompanyName": null,
                                            "Position": 1
                                        }
                                    ],
                                    "CompanyName": null,
                                    "Position": 0
                                }
                            ],
                            "CompanyName": null,
                            "Position": 1
                        }
                    ],
                    "CompanyName": null,
                    "Position": 1
                },
                {
                    "ID": "bb2199dd-d557-418f-91a9-537e9d540f06",
                    "Name": "Type",
                    "Object": {
                        "ID": "362e4c6c-f3ba-4e55-b759-0d07c18b1879",
                        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                        "InstanceID": null,
                        "Key": "Type",
                        "Value": "Manufacturing"
                    },
                    "NodeType": "STATIC_ATTRIBUTE",
                    "ChildNodes": [],
                    "CompanyName": null,
                    "Position": 2
                },
                {
                    "ID": "7d344e61-750e-42ef-832b-b74b91feaf71",
                    "Name": "Plant Code",
                    "Object": {
                        "ID": "f11c264c-c206-4070-bb97-fcf6cd707562",
                        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                        "InstanceID": null,
                        "Key": "Plant Code",
                        "Value": " "
                    },
                    "NodeType": "STATIC_ATTRIBUTE",
                    "ChildNodes": [],
                    "CompanyName": null,
                    "Position": 3
                },
                {
                    "ID": "92d7422e-48c6-4210-8706-76b50e10ece2",
                    "Name": "Location",
                    "Object": {
                        "ID": "6f4374ad-ec7a-40a4-8dcd-89cce0bf8943",
                        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                        "InstanceID": null,
                        "Key": "Location",
                        "Value": "Los Angeles, CA, USA"
                    },
                    "NodeType": "STATIC_ATTRIBUTE",
                    "ChildNodes": [],
                    "CompanyName": null,
                    "Position": 4
                },
                {
                    "ID": "119f4d46-39e5-42d3-9ba5-dd5f829534c5",
                    "Name": "Business Group",
                    "Object": {
                        "ID": "f30b7800-c644-4161-83e8-7791f822ff3f",
                        "ModelID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
                        "InstanceID": null,
                        "Key": "Business Group",
                        "Value": "Automotive"
                    },
                    "NodeType": "STATIC_ATTRIBUTE",
                    "ChildNodes": [],
                    "CompanyName": null,
                    "Position": 5
                }
            ],
            "CompanyName": null,
            "Position": 0
        }
    ],
    "CompanyName": "solutions",
    "Position": 0
}
```

---

## Save Changes to DigitalTwin Model

**POST** `{{LEM_URL}}/api/v1/dt2/model/complete/{{company_name}}`

# Save Changes to DigitalTwin Model (transactional)

Applies a batch of edits to one model atomically: create / update / delete static and dynamic attributes in a single transaction. Used by the LEM UI to commit every edit in the model editor in one round trip.

The request envelope groups changes by kind (`createStaticAttributes[]`, `updateStaticAttributes[]`, `delStaticAttributes[]`, `createDynamicAttributes[]`, `updateDynamicAttributes[]`, `delDynamicAttributes[]`). Pass empty arrays for any kind you don't need.

## Endpoint

```http
POST {{LEM_URL}}/api/v1/dt2/model/complete/{{company_name}}
Content-Type: application/json
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Request body

```json
{
  "modelId": "{{LEM_DT_Model_ID}}",
  "createStaticAttributes": [
    {
      "ID": "eed5f265-a24b-4856-a5c1-0b3683506b9c",
      "ModelID": "{{LEM_DT_Model_ID}}",
      "InstanceID": null,
      "Key": "Serial",
      "Value": "$EDGE_DT_MODEL_NAME",
      "$isNew": true
    }
  ],
  "updateStaticAttributes": [],
  "delStaticAttributes": [],
  "createDynamicAttributes": [],
  "updateDynamicAttributes": [],
  "delDynamicAttributes": []
}
```

| Field                          | Type    | Required | Description                                                                       |
|--------------------------------|---------|----------|-----------------------------------------------------------------------------------|
| `modelId`                      | string  | Yes      | Target model UUID.                                                                |
| `createStaticAttributes[]`     | object[]| No       | Static attrs to create. Each item carries `ID` (caller-generated), `Key`, `Value`, plus `$isNew: true`. |
| `updateStaticAttributes[]`     | object[]| No       | Static attrs to update. Each item has `ID`, `Key`, `Value`.                        |
| `delStaticAttributes[]`        | object[]| No       | Static attrs to delete. Each item has just `{ID}`.                                 |
| `createDynamicAttributes[]` / `updateDynamicAttributes[]` / `delDynamicAttributes[]` | object[] | No | Same shape, for dynamic attrs. |

## Response

`200 OK` -- `application/json`. Returns the post-edit model record with bumped `Version`.

```json
{
  "hasImage": true,
  "ID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
  "Name": "PlantModel",
  "CompanyName": "solutions",
  "RootNodeID": "5fdfd55f-38ff-4406-ab57-9c41c8f92ab6",
  "Version": 4
}
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Request Body

```json
{
    "modelId": "{{LEM_DT_Model_ID}}",
    "createStaticAttributes": [
        {
            "ID": "eed5f265-a24b-4856-a5c1-0b3683506b9c",
            "ModelID": "{{LEM_DT_Model_ID}}",
            "InstanceID": null,
            "Key": "Serial",
            "Value": "$EDGE_DT_MODEL_NAME",
            "$isNew": true
        }
    ],
    "updateStaticAttributes": [],
    "delStaticAttributes": [],
    "createDynamicAttributes": [],
    "updateDynamicAttributes": [],
    "delDynamicAttributes": [],
    "createTransformations": [],
    "updateTransformations": [],
    "deleteTransformations": [],
    "saveHierarchy": null
}
```

### Response

**Status**: 200 OK

```Text
{
    "hasImage": true,
    "ID": "2f00a759-96d8-4b2c-acd6-6861542f65b2",
    "Name": "PlantModel",
    "CompanyName": "solutions",
    "Description": "",
    "Assets": "ASSET",
    "ImagePreviewUrl": null,
    "ImageUrl": null,
    "RootNodeID": "5fdfd55f-38ff-4406-ab57-9c41c8f92ab6",
    "Version": 4
}
```

---

## Get Attribute Parameters

**GET** `{{LEM_URL}}/api/v1/dt2/attribute-parameters/{{LEM_DT_Model_ID}}`

# Get Attribute Parameters

Returns the list of attribute **parameters** for a model. Parameters are free-form `(Name, Value)` pairs attached to an owner (`ownerType: 0` = model, other values reserved). They behave like static attributes for templated bindings.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/dt2/attribute-parameters/{{LEM_DT_Model_ID}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Response

`200 OK` -- `application/json`

| Field           | Type    | Description                                                                                |
|-----------------|---------|--------------------------------------------------------------------------------------------|
| `ID`            | string  | Parameter UUID.                                                                            |
| `ModelID`       | string  | Parent model UUID (echo of path parameter).                                                |
| `ownerId`       | string  | UUID of the parameter's owner (model or attribute).                                        |
| `ownerType`     | integer | `0` = model. Other values reserved for future owner kinds.                                  |
| `Name` / `Value`| string  | Parameter key/value.                                                                       |

```json
[
  {
    "ownerId": "e75dc5b0-2dec-4d1a-b45c-ec01884875d4",
    "ownerType": 0,
    "ID": "e5027b6f-423a-4af2-a9bf-f4f20b3d8aab",
    "ModelID": "e75dc5b0-2dec-4d1a-b45c-ec01884875d4",
    "Name": "test",
    "Value": "value"
  }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```Text
[
    {
        "ownerId": "e75dc5b0-2dec-4d1a-b45c-ec01884875d4",
        "ownerType": 0,
        "ID": "e5027b6f-423a-4af2-a9bf-f4f20b3d8aab",
        "ModelID": "e75dc5b0-2dec-4d1a-b45c-ec01884875d4",
        "Name": "test",
        "Value": "value"
    }
]
```

---

## Get DigitalTwin Models

**GET** `{{LEM_URL}}/api/v1/dt2/models/{{company_name}}`

# Get DigitalTwin Models

Lists every digital twin model defined for one company.

## Endpoint

```http
GET {{LEM_URL}}/api/v1/dt2/models/{{company_name}}
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Path parameters

| Location | Name                | Required | Description                                  |
|----------|---------------------|----------|----------------------------------------------|
| Path     | `{{company_name}}`  | Yes      | Company slug.                                |

## Response

`200 OK` -- `application/json`. Array of model objects.

| Field                | Type    | Description                                                                                |
|----------------------|---------|--------------------------------------------------------------------------------------------|
| `ID`                 | string  | Model UUID. Use as `{{LEM_DT_Model_ID}}` in subsequent calls.                              |
| `Name`               | string  | Display name.                                                                              |
| `CompanyName`        | string  | Owning company (echo of path parameter).                                                   |
| `Description`        | string  | Free-form description.                                                                     |
| `Assets`             | string  | Asset category (free-form grouping; default `ASSET`).                                       |
| `hasImage`           | boolean | Whether an image is attached.                                                              |
| `ImagePreviewUrl`    | string  | URL to a thumbnail of the model's image, or `null`.                                        |
| `ImageUrl`           | string  | URL to the full-size image, or `null`.                                                     |
| `RootNodeID`         | string  | UUID of the model's root hierarchy node.                                                   |
| `Version`            | integer | Schema version (increments on save).                                                       |

```json
[
  {
    "hasImage": false,
    "ID": "6e2976a8-1bd8-44c7-959d-27f18c006881",
    "Name": "api-test",
    "CompanyName": "solutions",
    "Description": "Test DT model",
    "Assets": "ASSET",
    "ImagePreviewUrl": null,
    "ImageUrl": null,
    "RootNodeID": "5c48fd61-2237-42bc-b262-daf8cf79bfe0",
    "Version": 0
  }
]
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Response

**Status**: 200 OK

```Text
[
    {
        "hasImage": false,
        "ID": "6e2976a8-1bd8-44c7-959d-27f18c006881",
        "Name": "api-test",
        "CompanyName": "solutions",
        "Description": "Test DT model",
        "Assets": "ASSET",
        "ImagePreviewUrl": null,
        "ImageUrl": null,
        "RootNodeID": "5c48fd61-2237-42bc-b262-daf8cf79bfe0",
        "Version": 0
    }
]
```

---

## Create DigitalTwin Model

**POST** `{{LEM_URL}}/api/v1/dt2/model/{{company_name}}`

# Create DigitalTwin Model

Creates a new digital twin model inside one company. The new model starts empty -- populate attributes and hierarchy via `Digital Twin Model Details > Save Changes to DigitalTwin Model`.

## Endpoint

```http
POST {{LEM_URL}}/api/v1/dt2/model/{{company_name}}
Content-Type: application/json
```

## Authentication

HTTP Basic Auth. **Username** is your API token, **password** is empty. Tokens are managed under `System > Access Control > Tokens`.

## Path parameters

| Location | Name                | Required | Description                                  |
|----------|---------------------|----------|----------------------------------------------|
| Path     | `{{company_name}}`  | Yes      | Owning company slug.                          |

## Request body

```json
{
  "ID": null,
  "Name": "api-test",
  "Description": "Test DT model",
  "Assets": "ASSET"
}
```

| Field           | Type    | Required | Description                                                                       |
|-----------------|---------|----------|-----------------------------------------------------------------------------------|
| `ID`            | string? | No       | Pass `null` to let the server generate a UUID. Provide a UUID to use a specific one. |
| `Name`          | string  | Yes      | Display name. Must be unique within the company.                                  |
| `Description`   | string  | No       | Free-form description.                                                            |
| `Assets`        | string  | No       | Asset category (default `ASSET`).                                                  |

## Response

`200 OK` -- `application/json`. Returns the newly created model with its server-assigned `ID` and `RootNodeID`.

```json
{
  "hasImage": false,
  "ID": "6e2976a8-1bd8-44c7-959d-27f18c006881",
  "Name": "api-test",
  "CompanyName": "solutions",
  "Description": "Test DT model",
  "Assets": "ASSET",
  "ImagePreviewUrl": null,
  "ImageUrl": null,
  "RootNodeID": "5c48fd61-2237-42bc-b262-daf8cf79bfe0",
  "Version": 0
}
```

## Errors

| HTTP status         | When it happens                                                                |
|---------------------|--------------------------------------------------------------------------------|
| `400 Bad Request`   | Missing or malformed query/body parameter.                                     |
| `401 Unauthorized`  | Missing or invalid credentials.                                                |
| `403 Forbidden`     | Token lacks permission for this operation.                                     |
| `404 Not Found`     | Target entity does not exist.                                                  |
| `5xx`               | Service is unreachable, restarting, or internally errored. Inspect device logs under `System > Support`. |

> **TLS note**: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.


### Request Body

```json
{
    "Assets": "ASSET",
    "Description": "Test DT model",
    "ID": null,
    "Name": "api-test"
}
```

### Response

**Status**: 200 OK

```Text
{
    "hasImage": false,
    "ID": "6e2976a8-1bd8-44c7-959d-27f18c006881",
    "Name": "api-test",
    "CompanyName": "solutions",
    "Description": "Test DT model",
    "Assets": "ASSET",
    "ImagePreviewUrl": null,
    "ImageUrl": null,
    "RootNodeID": "5c48fd61-2237-42bc-b262-daf8cf79bfe0",
    "Version": 0
}
```

---

