Skip to main content

Device Management

Create, update, delete, and list devices from your application.

Access via app.device.

API

create()

Register a new device and receive its credentials.

await app.device.create(params)
ParameterTypeDescription
identstringUnique device identifier
schemaobjectDefines the telemetry metrics — each key is a metric name with type, unit, and unit_symbol
configobjectInitial device configuration

Returns the created device object (including credentials for the Device SDK)

Naming rules

Device identifiers can only contain letters, numbers, hyphens, and underscores (A-Z, a-z, 0-9, -, _).

const device = await app.device.create({
ident: "sensor_01",
schema: {
temperature: { type: "number", unit: "Celsius", unit_symbol: "°C" },
humidity: { type: "number", unit: "Percent", unit_symbol: "%" },
status: { type: "string", unit: "Status", unit_symbol: "" },
},
config: {
reportInterval: 5000,
location: "warehouse-A",
},
});

// device.creds contains the api_key and secret
// for initializing the Device SDK
console.log("Device created:", device.ident);

Example response:

{
"id": "69ca39e4ed4d9fe786145b48",
"ident": "sensor_01",
"schema": {
"temperature": { "type": "number", "unit": "Celsius", "unit_symbol": "°C" },
"humidity": { "type": "number", "unit": "Percent", "unit_symbol": "%" },
"status": { "type": "string", "unit": "Status", "unit_symbol": "" }
},
"config": {
"reportInterval": 5000,
"location": "warehouse-A"
},
"creds": {
"api_key": "eyJ0eXAiOiJKV1Qi...",
"secret": "SUAO6FXS2MMQMZ6U..."
}
}
Store your credentials

The creds field is only returned on create() and is not saved on the backend. Store creds.api_key and creds.secret securely — you'll need them to initialize the Device SDK and they cannot be retrieved again.

Device limit

The number of devices you can create depends on your plan.

update()

Update a device's identifier, schema, or configuration.

await app.device.update(params)
ParameterTypeDescription
idstringThe device ID (from the device object)
identstring(optional) New device identifier
schemaobject(optional) Updated schema
configobject(optional) Updated configuration

Returns the updated device object

const updated = await app.device.update({
id: device.id,
config: {
reportInterval: 10000,
location: "warehouse-B",
},
});

Example response:

{
"id": "69ca39e4ed4d9fe786145b48",
"ident": "sensor_01",
"schema": {
"temperature": { "type": "number", "unit": "Celsius", "unit_symbol": "°C" },
"humidity": { "type": "number", "unit": "Percent", "unit_symbol": "%" }
},
"config": { "reportInterval": 10000, "location": "warehouse-B" }
}

delete()

Permanently remove a device and its credentials.

await app.device.delete(ident)
ParameterTypeDescription
identstringThe device identifier to delete

Returns true if deleted successfully

const deleted = await app.device.delete("sensor_01");
console.log(deleted ? "Deleted" : "Failed");

list()

Retrieve all devices in your organization.

await app.device.list()

Returns an array of all device objects

const devices = await app.device.list();

devices.forEach((device) => {
console.log(`${device.ident}${JSON.stringify(device.schema)}`);
});

Example response:

[
{
"id": "69ca39e4ed4d9fe786145b48",
"ident": "sensor_01",
"schema": {
"temperature": { "type": "number", "unit": "Celsius", "unit_symbol": "°C" },
"humidity": { "type": "number", "unit": "Percent", "unit_symbol": "%" }
},
"config": { "reportInterval": 5000 }
},
{
"id": "69ca3a12ed4d9fe786145b49",
"ident": "sensor_02",
"schema": {
"pressure": { "type": "number", "unit": "Pascal", "unit_symbol": "Pa" }
},
"config": {}
}
]

get()

Retrieve a single device by its identifier.

await app.device.get(params)
ParameterTypeDescription
identstringThe device identifier to look up

Returns the device object

const device = await app.device.get({ ident: "sensor_01" });
console.log("Schema:", device.schema);
console.log("Config:", device.config);

Example response:

{
"id": "69ca39e4ed4d9fe786145b48",
"ident": "sensor_01",
"schema": {
"temperature": { "type": "number", "unit": "Celsius", "unit_symbol": "°C" },
"humidity": { "type": "number", "unit": "Percent", "unit_symbol": "%" }
},
"config": { "reportInterval": 5000, "location": "warehouse-A" }
}

Schema Structure

Each metric in the schema is an object with three fields:

FieldTypeDescription
typestringThe data type: "number", "string", "boolean", or "json"
unitstringHuman-readable unit name (e.g., "Celsius", "Percent")
unit_symbolstringUnit symbol for display (e.g., "°C", "%")

Supported Types

TypeDescription
"number"Integer or floating-point values
"string"Text values
"boolean"true / false
"json"Objects and arrays

Device Caching

The SDK maintains a local cache of devices that is populated on connect(). The cache has a 2-hour TTL and is automatically updated when you call create(), update(), or delete(). This means list() and get() are fast for repeated calls.