> ## 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 Device from Owner

> Remove device-to-customer assignment

## Overview

Removes the device-to-customer assignment. Both records remain in the system; only the association is removed.

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

## Authentication

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

## Request Body

<ParamField body="deviceIdentifier" type="string" required>
  The unique identifier for the device (e.g., serial number, MAC address)
</ParamField>

<ParamField body="customerEmail" type="string" required>
  The email address of the customer to unassign the device from
</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="deviceIdentifier" type="string">
  The device identifier that was unassigned
</ResponseField>

<ResponseField name="devicesRemaining" type="array">
  Array of device identifiers still assigned to this customer after the unassignment
</ResponseField>

## Examples

### Request

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

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDeviceFromOwner',
    {
      method: 'POST',
      headers: {
        'x-api-key': 'your_api_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        deviceIdentifier: 'SN-12345-ABCDE',
        customerEmail: 'john.doe@example.com'
      })
    }
  );

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

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

  response = requests.post(
      'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDeviceFromOwner',
      headers={
          'x-api-key': 'your_api_key_here',
          'Content-Type': 'application/json'
      },
      json={
          'deviceIdentifier': 'SN-12345-ABCDE',
          'customerEmail': 'john.doe@example.com'
      }
  )

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

### Response

<CodeGroup>
  ```json Success theme={null}
  {
    "success": true,
    "message": "Device successfully unassigned from customer",
    "customerId": "cust_a1b2c3d4e5f6",
    "deviceIdentifier": "SN-12345-ABCDE",
    "devicesRemaining": ["SN-67890-FGHIJ"]
  }
  ```

  ```json Success - No Devices Remaining theme={null}
  {
    "success": true,
    "message": "Device successfully unassigned from customer",
    "customerId": "cust_a1b2c3d4e5f6",
    "deviceIdentifier": "SN-12345-ABCDE",
    "devicesRemaining": []
  }
  ```

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

  ```json Error - Device Not Assigned theme={null}
  {
    "error": "Device is not assigned to this customer",
    "customerId": "cust_a1b2c3d4e5f6",
    "deviceIdentifier": "SN-12345-ABCDE",
    "currentDevices": ["SN-67890-FGHIJ", "SN-11111-KKKKK"]
  }
  ```
</CodeGroup>

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

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDeviceFromOwner',
    {
      method: 'POST',
      headers: {
        'x-api-key': 'your_api_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        deviceIdentifier: 'SN-12345-ABCDE',
        customerEmail: 'john.doe@example.com'
      })
    }
  );

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

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

  response = requests.post(
      'https://admin.telemetron.ai/api/ext-v1/deviceAssignment/unassignDeviceFromOwner',
      headers={
          'x-api-key': 'your_api_key_here',
          'Content-Type': 'application/json'
      },
      json={
          'deviceIdentifier': 'SN-12345-ABCDE',
          'customerEmail': 'john.doe@example.com'
      }
  )

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

<ResponseExample>
  ```json Success theme={null}
  {
    "success": true,
    "message": "Device successfully unassigned from customer",
    "customerId": "cust_a1b2c3d4e5f6",
    "deviceIdentifier": "SN-12345-ABCDE",
    "devicesRemaining": ["SN-67890-FGHIJ"]
  }
  ```

  ```json Success - No Devices Remaining theme={null}
  {
    "success": true,
    "message": "Device successfully unassigned from customer",
    "customerId": "cust_a1b2c3d4e5f6",
    "deviceIdentifier": "SN-12345-ABCDE",
    "devicesRemaining": []
  }
  ```

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

  ```json Error - Device Not Assigned theme={null}
  {
    "error": "Device is not assigned to this customer",
    "customerId": "cust_a1b2c3d4e5f6",
    "deviceIdentifier": "SN-12345-ABCDE",
    "currentDevices": ["SN-67890-FGHIJ", "SN-11111-KKKKK"]
  }
  ```

  ```json Error - Invalid Email theme={null}
  {
    "error": "Invalid email format"
  }
  ```

  ```json Error - Missing Required Fields theme={null}
  {
    "error": "Both deviceIdentifier and customerEmail are required"
  }
  ```

  ```json Error - Invalid JSON theme={null}
  {
    "error": "Invalid JSON in request body"
  }
  ```
</ResponseExample>

## Status Codes

| Code | Description                                                                                         |
| ---- | --------------------------------------------------------------------------------------------------- |
| 200  | Device successfully unassigned from customer                                                        |
| 400  | Invalid request (missing required fields, invalid email format, or device not assigned to customer) |
| 401  | Invalid or missing API key                                                                          |
| 404  | Customer not found in your organization                                                             |
| 500  | Internal server error                                                                               |

## Notes

* Email format is validated before processing
* Non-destructive: customer and device records persist
* Response includes `devicesRemaining` array for tracking

## Common Use Cases

* **Device returns/replacements**: Stop routing telemetry to this customer
* **Ownership transfer**: Unassign from old owner, then assign to new owner
* **Account cleanup**: Remove inactive devices from customer accounts

<Tip>
  **Transfer Pattern**: Unassign from old owner → Assign to new owner. See [Assign Device](/api-reference/device/assign-device).
</Tip>
