Skip to main content
POST
/
api
/
ext-v1
/
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"
    }
  }'
{
  "success": true,
  "message": "Device created successfully",
  "deviceId": "dev_abc123",
  "identifier": "sensor-001",
  "type": "sensor"
}

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

x-api-key
string
required
Your organization’s API key

Request Body

identifier
string
required
A unique identifier for the device. Must be a non-empty string.
type
string
The device type (e.g., "sensor", "gateway", "controller"). Required when creating a new device. Optional when updating an existing device.
properties
object
Optional metadata object containing additional device properties.

Response

success
boolean
Indicates whether the operation was successful.
message
string
A human-readable message describing the result.
deviceId
string
The unique ID of the created or updated device.
identifier
string
The identifier of the device.
type
string | null
The device type.

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 -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 -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": true,
  "message": "Device created successfully",
  "deviceId": "dev_abc123",
  "identifier": "sensor-001",
  "type": "sensor"
}
{
  "success": true,
  "message": "Device created successfully",
  "deviceId": "dev_abc123",
  "identifier": "sensor-001",
  "type": "sensor"
}

Status Codes

CodeDescription
200Device successfully created or updated
400Validation error (missing or invalid fields, invalid JSON)
401Authentication error (missing or invalid API key)
500Internal server error