Device Assignment
Assign Devices to Owner
Assign multiple devices to a single customer
POST
/
api
/
ext-v1
/
deviceAssignment
/
assignDevicesToOwner
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002", "SN-003"]
}'
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002"],
"autoCreateDevices": true,
"deviceType": "sensor"
}'
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002', 'SN-003']
})
}
);
const result = await response.json();
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002'],
autoCreateDevices: true,
deviceType: 'sensor'
})
}
);
const result = await response.json();
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002', 'SN-003']
}
)
result = response.json()
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002'],
'autoCreateDevices': True,
'deviceType': 'sensor'
}
)
result = response.json()
{
"success": true,
"message": "Successfully assigned 2 device(s) to customer",
"customerId": "cust_abc123",
"customerWasCreated": false,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false }
],
"alreadyAssigned": [
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": false }
],
"skipped": ["SN-003"]
}
{
"success": true,
"message": "Successfully assigned 3 device(s) to customer",
"customerId": "cust_abc123",
"customerWasCreated": false,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false },
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": false },
{ "identifier": "SN-003", "deviceId": "dev_d7e8f9", "wasCreated": true }
],
"alreadyAssigned": [],
"skipped": []
}
{
"error": "No valid devices found to assign"
}
{
"error": "deviceType is required when autoCreateDevices is true"
}
Overview
Assigns multiple devices to a single customer in one request. This is the bulk variant for assigning devices — use this when provisioning several devices for the same customer. Features:- Assign multiple devices to one customer in a single call
- Auto-creates the customer if they don’t exist
- Optional auto-create for devices (requires
deviceType) - Reports which devices were newly assigned, already assigned, or skipped
Authentication
Request Body
Array of device identifiers (e.g., serial numbers, MAC addresses) to assign. Must be a non-empty array.
If
true, creates devices automatically if they don’t exist in the system. Defaults to false.Required when
autoCreateDevices is true. Specifies the device type (e.g., “sensor”, “Thermostat”, “Gateway”).Response
Array of device identifier strings that were not found in the system (when
autoCreateDevices is false)Examples
Basic Bulk Assignment
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002", "SN-003"]
}'
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002', 'SN-003']
})
}
);
const result = await response.json();
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002', 'SN-003']
}
)
result = response.json()
With Auto-Create Devices
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002"],
"autoCreateDevices": true,
"deviceType": "sensor"
}'
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002'],
autoCreateDevices: true,
deviceType: 'sensor'
})
}
);
const result = await response.json();
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002'],
'autoCreateDevices': True,
'deviceType': 'sensor'
}
)
result = response.json()
Response
{
"success": true,
"message": "Successfully assigned 2 device(s) to customer",
"customerId": "cust_abc123",
"customerWasCreated": false,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false }
],
"alreadyAssigned": [
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": false }
],
"skipped": ["SN-003"]
}
{
"success": true,
"message": "Successfully assigned 2 device(s) to customer",
"customerId": "cust_new789",
"customerWasCreated": true,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false },
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": true }
],
"alreadyAssigned": [],
"skipped": []
}
{
"error": "Invalid input: customerEmail is required"
}
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002", "SN-003"]
}'
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002"],
"autoCreateDevices": true,
"deviceType": "sensor"
}'
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002', 'SN-003']
})
}
);
const result = await response.json();
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002'],
autoCreateDevices: true,
deviceType: 'sensor'
})
}
);
const result = await response.json();
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002', 'SN-003']
}
)
result = response.json()
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002'],
'autoCreateDevices': True,
'deviceType': 'sensor'
}
)
result = response.json()
{
"success": true,
"message": "Successfully assigned 2 device(s) to customer",
"customerId": "cust_abc123",
"customerWasCreated": false,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false }
],
"alreadyAssigned": [
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": false }
],
"skipped": ["SN-003"]
}
{
"success": true,
"message": "Successfully assigned 3 device(s) to customer",
"customerId": "cust_abc123",
"customerWasCreated": false,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false },
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": false },
{ "identifier": "SN-003", "deviceId": "dev_d7e8f9", "wasCreated": true }
],
"alreadyAssigned": [],
"skipped": []
}
{
"error": "No valid devices found to assign"
}
{
"error": "deviceType is required when autoCreateDevices is true"
}
Status Codes
| Code | Description |
|---|---|
| 200 | Devices successfully assigned to customer |
| 400 | Invalid request (missing required fields, empty array, or no valid devices) |
| 401 | Invalid or missing API key |
| 500 | Internal server error |
Implementation Notes
- Idempotent: Devices already assigned to the customer are reported in
alreadyAssigned— no duplicates are created - Auto-create customer: The customer is automatically created if they don’t exist
- Partial success: The response details which devices were assigned, already assigned, or skipped, allowing you to handle each case
- Skipped devices: When
autoCreateDevicesisfalse, unknown device identifiers are returned in theskippedarray
Required: When
autoCreateDevices is true, you must provide deviceType or the request will fail with a 400 error.⌘I
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002", "SN-003"]
}'
curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john.doe@example.com",
"deviceIdentifiers": ["SN-001", "SN-002"],
"autoCreateDevices": true,
"deviceType": "sensor"
}'
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002', 'SN-003']
})
}
);
const result = await response.json();
const response = await fetch(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
{
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerEmail: 'john.doe@example.com',
deviceIdentifiers: ['SN-001', 'SN-002'],
autoCreateDevices: true,
deviceType: 'sensor'
})
}
);
const result = await response.json();
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002', 'SN-003']
}
)
result = response.json()
import requests
response = requests.post(
'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/assignDevicesToOwner',
headers={
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
json={
'customerEmail': 'john.doe@example.com',
'deviceIdentifiers': ['SN-001', 'SN-002'],
'autoCreateDevices': True,
'deviceType': 'sensor'
}
)
result = response.json()
{
"success": true,
"message": "Successfully assigned 2 device(s) to customer",
"customerId": "cust_abc123",
"customerWasCreated": false,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false }
],
"alreadyAssigned": [
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": false }
],
"skipped": ["SN-003"]
}
{
"success": true,
"message": "Successfully assigned 3 device(s) to customer",
"customerId": "cust_abc123",
"customerWasCreated": false,
"assignedDevices": [
{ "identifier": "SN-001", "deviceId": "dev_x1y2z3", "wasCreated": false },
{ "identifier": "SN-002", "deviceId": "dev_a4b5c6", "wasCreated": false },
{ "identifier": "SN-003", "deviceId": "dev_d7e8f9", "wasCreated": true }
],
"alreadyAssigned": [],
"skipped": []
}
{
"error": "No valid devices found to assign"
}
{
"error": "deviceType is required when autoCreateDevices is true"
}