Create Device
Now that the blueprint is complete, we can create the device programmatically using the Enapter CLI or HTTP API. This is useful for automating deployments or managing devices without a graphical interface.
For graphical approaches, see Level 1.
Prerequisites
Get Enapter API Token for both approaches.
- Enapter CLI
- HTTP API
0. Configure connection
Follow the guide to set enapter-cli connection up.
1. Get UCM Device ID
List all devices to find the UCM that will serve as a runtime:
$ enapter3 device list
Response:
{
"devices": [
{
"authorized_role": "INSTALLER",
"blueprint_id": "e44a7c47-b19c-5a21-83f4-9e2ec56ad54a",
"id": "e73b2e42-28fb-4ad3-8b4a-463dbd31ebe8",
"implemented_profiles": [],
"name": "UCM 98E7D5",
"site_id": "72a0ea68-9430-457a-a30a-946cacc74295",
"slug": "ucm-98e7d5",
"type": "HARDWARE_UCM",
"updated_at": "2026-02-05T14:45:40.698147Z"
},
{
"authorized_role": "INSTALLER",
"blueprint_id": "0731254e-bfaa-5f90-8223-a53125b005ec",
"id": "f646aecf-96b7-4c95-85e4-af6d0932579b",
"implemented_profiles": [],
"name": "Virtual UCM",
"site_id": "72a0ea68-9430-457a-a30a-946cacc74295",
"slug": "virtual-ucm",
"type": "VIRTUAL_UCM",
"updated_at": "2026-02-05T14:43:11.24156Z"
}
],
"total_count": 2
}
We need the id value of the UCM we want to use as a runtime, e.g. e73b2e42-28fb-4ad3-8b4a-463dbd31ebe8 for UCM 98E7D5.
2. Create Lua Device
$ enapter3 device create lua-device \
--blueprint-path="<path/to/blueprint/folder>" \
--runtime-id="e73b2e42-28fb-4ad3-8b4a-463dbd31ebe8" \
--device-name="H2 Sensor"
Response:
{
"device_id":"dfbf9503-ce26-476d-878a-01f9d46fed32",
"slug":"h2-sensor"
}
The CLI automatically packages and uploads the blueprint. The device is now created and running.
Ensure you're using the correct API base URL. The examples below use the Enapter Gateway hostname.
1. Get UCM Device ID
$ curl http://enapter-gateway.local/api/v3/devices \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}'
Response:
{
"devices": [
{
"authorized_role": "INSTALLER",
"blueprint_id": "e44a7c47-b19c-5a21-83f4-9e2ec56ad54a",
"id": "e73b2e42-28fb-4ad3-8b4a-463dbd31ebe8",
"implemented_profiles": [],
"name": "UCM 98E7D5",
"site_id": "72a0ea68-9430-457a-a30a-946cacc74295",
"slug": "ucm-98e7d5",
"type": "HARDWARE_UCM",
"updated_at": "2026-02-05T14:45:40.698147Z"
},
{
"authorized_role": "INSTALLER",
"blueprint_id": "0731254e-bfaa-5f90-8223-a53125b005ec",
"id": "f646aecf-96b7-4c95-85e4-af6d0932579b",
"implemented_profiles": [],
"name": "Virtual UCM",
"site_id": "72a0ea68-9430-457a-a30a-946cacc74295",
"slug": "virtual-ucm",
"type": "VIRTUAL_UCM",
"updated_at": "2026-02-05T14:43:11.24156Z"
}
],
"total_count": 2
}
We need the id value of the target UCM, e.g. e73b2e42-28fb-4ad3-8b4a-463dbd31ebe8.
2. Zip Blueprint Folder
Package the blueprint files into a zip archive without a root folder:
zip -j -r blueprint.zip <path/to/blueprint/folder>
3. Upload Blueprint
$ curl -X POST \
http://enapter-gateway.local/api/v3/blueprints/upload \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-F data=@blueprint.zip
Response:
{
"blueprint": {
"id":"d7084e46-94a4-4f8c-ae08-70fc2d4c62c5",
"created_at":"2026-02-05T15:34:09.782227Z"
}
}
4. Create Lua Device
$ curl -X POST \
http://enapter-gateway.local/api/v3/provisioning/lua_device \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{
"runtime_id": "e73b2e42-28fb-4ad3-8b4a-463dbd31ebe8",
"blueprint_id": "d7084e46-94a4-4f8c-ae08-70fc2d4c62c5",
"name": "H2 Sensor"
}'
Response:
{
"device_id":"dfbf9503-ce26-476d-878a-01f9d46fed32",
"slug":"h2-sensor"
}
Next Steps
After creating the device, configure it using the Enapter CLI or HTTP API.