> ## Documentation Index
> Fetch the complete documentation index at: https://docs.telemetron.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Unassign Devices from Owner

> Unassign multiple devices from a single customer

## Overview

Removes multiple device-to-customer assignments in a single request. This is the bulk variant for unassigning devices — use this when removing several devices from the same customer at once.

Both the device and customer records remain in the system; only the associations are removed.

<Warning>
  After unassignment, device telemetry will no longer route to this customer. Reassign devices to a new owner if they are still active.
</Warning>

## Authentication

<ParamField header="x-api-key" type="string" required>
  Your organization's API key
</ParamField>

## Request Body

<ParamField body="customerEmail" type="string" required>
  The email address of the customer to unassign devices from. Must be a valid email format.
</ParamField>

<ParamField body="deviceIdentifiers" type="array" required>
  Array of device identifiers (e.g., serial numbers, MAC addresses) to unassign. Must be a non-empty array.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the operation was successful
</ResponseField>

<ResponseField name="message" type="string">
  Description of the operation result
</ResponseField>

<ResponseField name="customerId" type="string">
  The unique identifier of the customer
</ResponseField>

<ResponseField name="unassignedDevices" type="array">
  Array of device identifier strings that were successfully unassigned
</ResponseField>

<ResponseField name="skipped" type="array">
  Array of device identifier strings that were not assigned to this customer (no-op)
</ResponseField>

<ResponseField name="devicesRemaining" type="array">
  Full list of device identifiers still assigned to the customer after the operation
</ResponseField>

## Examples

### Bulk Unassignment

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDevicesFromOwner \
    -H "x-api-key: your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "customerEmail": "john.doe@example.com",
      "deviceIdentifiers": ["SN-001", "SN-002"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDevicesFromOwner',
    {
      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']
      })
    }
  );

  const result = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDevicesFromOwner',
      headers={
          'x-api-key': 'your_api_key_here',
          'Content-Type': 'application/json'
      },
      json={
          'customerEmail': 'john.doe@example.com',
          'deviceIdentifiers': ['SN-001', 'SN-002']
      }
  )

  result = response.json()
  ```
</CodeGroup>

### Response

<CodeGroup>
  ```json Success - Mixed Results theme={null}
  {
    "success": true,
    "message": "Successfully unassigned 1 device(s) from customer",
    "customerId": "cust_abc123",
    "unassignedDevices": ["SN-001"],
    "skipped": ["SN-002"],
    "devicesRemaining": ["SN-003"]
  }
  ```

  ```json Success - All Unassigned theme={null}
  {
    "success": true,
    "message": "Successfully unassigned 2 device(s) from customer",
    "customerId": "cust_abc123",
    "unassignedDevices": ["SN-001", "SN-002"],
    "skipped": [],
    "devicesRemaining": []
  }
  ```

  ```json Error - Customer Not Found theme={null}
  {
    "error": "Customer not found for this organization"
  }
  ```
</CodeGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDevicesFromOwner \
    -H "x-api-key: your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "customerEmail": "john.doe@example.com",
      "deviceIdentifiers": ["SN-001", "SN-002"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDevicesFromOwner',
    {
      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']
      })
    }
  );

  const result = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDevicesFromOwner',
      headers={
          'x-api-key': 'your_api_key_here',
          'Content-Type': 'application/json'
      },
      json={
          'customerEmail': 'john.doe@example.com',
          'deviceIdentifiers': ['SN-001', 'SN-002']
      }
  )

  result = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Success - Mixed Results theme={null}
  {
    "success": true,
    "message": "Successfully unassigned 1 device(s) from customer",
    "customerId": "cust_abc123",
    "unassignedDevices": ["SN-001"],
    "skipped": ["SN-002"],
    "devicesRemaining": ["SN-003"]
  }
  ```

  ```json Success - All Unassigned theme={null}
  {
    "success": true,
    "message": "Successfully unassigned 2 device(s) from customer",
    "customerId": "cust_abc123",
    "unassignedDevices": ["SN-001", "SN-002"],
    "skipped": [],
    "devicesRemaining": []
  }
  ```

  ```json Error - Customer Not Found theme={null}
  {
    "error": "Customer not found for this organization"
  }
  ```

  ```json Error - Invalid Input theme={null}
  {
    "error": "Invalid input: customerEmail and deviceIdentifiers are required"
  }
  ```
</ResponseExample>

## Status Codes

| Code | Description                                              |
| ---- | -------------------------------------------------------- |
| 200  | Devices successfully unassigned from customer            |
| 400  | Invalid request (missing required fields or empty array) |
| 401  | Invalid or missing API key                               |
| 404  | Customer not found in your organization                  |
| 500  | Internal server error                                    |

## Implementation Notes

* **Non-destructive**: Customer and device records persist; only the assignments are removed
* **Partial success**: The response details which devices were unassigned vs. skipped, so you can handle each case
* **Skipped devices**: Devices not currently assigned to the customer are returned in the `skipped` array
* **Remaining devices**: The `devicesRemaining` array shows the full list of devices still assigned after the operation

## Common Use Cases

* **Bulk device returns**: Unassign all returned devices from a customer in one call
* **Account decommissioning**: Remove all device assignments when closing a customer account
* **Fleet reassignment**: Unassign devices from one owner before reassigning to another

<Tip>
  **Bulk Transfer Pattern**: Unassign devices from old owner with this endpoint → Assign to new owner with [Assign Devices to Owner](/api-reference/device/assign-devices-to-owner).
</Tip>
