Overview
This endpoint allows you to create a new device or update an existing one using its unique identifier. When a device with the given identifier already exists, the provided fields will be updated. When no device exists with that identifier, a new device is created.
New devices require both identifier and type.
Existing devices can be updated by providing identifier along with any fields to change (type, properties).
Authentication
Your organization’s API key
Request Body
A unique identifier for the device. Must be a non-empty string.
The device type (e.g., "sensor", "gateway", "controller"). Required when creating a new device. Optional when updating an existing device.
Optional metadata object containing additional device properties.
Response
Indicates whether the operation was successful.
A human-readable message describing the result.
The unique ID of the created or updated device.
The identifier of the device.
Examples
Create a New Device
curl -X POST https://admin.telemetron.ai/api/ext-v1/device \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d '{
"identifier": "sensor-001",
"type": "sensor",
"properties": {
"location": "Building A",
"firmware": "v2.1.0",
"model": "TM-500"
}
}'
cURL - Create New Device
JavaScript - Create New Device
Python - Create New Device
curl -X POST https://admin.telemetron.ai/api/ext-v1/device \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d '{
"identifier": "sensor-001",
"type": "sensor",
"properties": {
"location": "Building A",
"firmware": "v2.1.0",
"model": "TM-500"
}
}'
Update an Existing Device
curl -X POST https://admin.telemetron.ai/api/ext-v1/device \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d '{
"identifier": "sensor-001",
"properties": {
"location": "Building B",
"firmware": "v2.2.0"
}
}'
cURL - Update Existing Device
JavaScript - Update Existing Device
Python - Update Existing Device
curl -X POST https://admin.telemetron.ai/api/ext-v1/device \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d '{
"identifier": "sensor-001",
"properties": {
"location": "Building B",
"firmware": "v2.2.0"
}
}'
Response
Success - Created
Success - Updated
Error - Missing Identifier
Error - Missing Type for New Device
{
"success" : true ,
"message" : "Device created successfully" ,
"deviceId" : "dev_abc123" ,
"identifier" : "sensor-001" ,
"type" : "sensor"
}
Success - Created
Success - Updated
Error - Missing Identifier
Error - Missing Type for New Device
Error - Missing API Key
Error - Invalid API Key
Error - Invalid JSON
{
"success" : true ,
"message" : "Device created successfully" ,
"deviceId" : "dev_abc123" ,
"identifier" : "sensor-001" ,
"type" : "sensor"
}
Status Codes
Code Description 200 Device successfully created or updated 400 Validation error (missing or invalid fields, invalid JSON) 401 Authentication error (missing or invalid API key) 500 Internal server error