Bulk deleting offline Android devices via Console or API
Android
Improved Title: Remove offline Android devices in bulk — Console or APIWhen offline Android devices accumulate in your Esper Console, removing them individually is slow and error-prone. Esper supports bulk deletion both through the Console UI for small batches and through the Esper API for large-scale cleanup.
Why this happens
Devices that are factory reset, lost, or decommissioned without being formally removed remain as inactive records in your Console. They must be explicitly deleted to keep your device inventory accurate. Because these devices are offline, any wipe command sent during deletion can never be delivered and will remain in a Pending state indefinitely — which is why the wipe option must be left unchecked for offline devices.
Before you begin
- Deletion permanently removes the device record from your Esper Console. This action cannot be undone.
- A deleted device cannot rejoin Esper from its existing state. It must be factory reset and reprovisioned.
- Always leave Wipe external storage on the device unchecked when deleting offline devices. For a device that will never reconnect, the wipe command will never execute and will remain stuck in a
Pendingstate. - For API deletion you need: your tenant name (visible in your Console URL), your enterprise ID, an API key with Device Management write permissions, and the device IDs you want to remove.
Option 1: Delete devices through the Esper Console (small batches)
Use this method when removing a manageable number of devices manually.
- Navigate to Devices & Groups in the Esper Console.
- Select each device to remove by checking the checkbox next to its name. Use filters to narrow results by group, status, or tag if needed.
- Click Actions → Delete.
- In the confirmation dialog, verify that Wipe external storage on the device is unchecked. Leaving this checked for offline devices creates a permanent
Pendingwipe command that can never be cleared. - Confirm the deletion.
Option 2: Delete devices using the Esper API (100+ devices)
Use this method to automate bulk deletion when managing a large number of devices. The Esper API supports deleting individual device records by iterating over device IDs.
Step 1: Retrieve device IDs
- If you have serial numbers but not device IDs, map them using the
GET devicesendpoint with aserial_numberfilter:
ReplaceGET https://{tenant}-api.esper.cloud/api/enterprise/{enterprise_id}/device/?serial_number={serial}{tenant},{enterprise_id}, and{serial}with your actual values. The response includes theidfield for each matching device. - Compile the list of
device_idvalues you want to delete before proceeding.
Step 2: Delete a single device via API
- Send a
DELETErequest to the following endpoint for each device ID:DELETE https://{tenant}-api.esper.cloud/api/enterprise/{enterprise_id}/device/{device_id}/?delete_seamless_info=false - Include your API key in the request header:
TheAuthorization: Bearer {your_api_key}delete_seamless_info=falseparameter ensures that provisioning metadata is not removed, which prevents issues if the same hardware is later reprovisioned.
Step 3: Run a bulk deletion script
- Use the following Python script to delete multiple devices in sequence:
import requests import time TENANT = "your-tenant" ENTERPRISE_ID = "your-enterprise-id" API_KEY = "your-api-key" HEADERS = {"Authorization": f"Bearer {API_KEY}"} device_ids = ["device_id_1", "device_id_2", "device_id_3"] for device_id in device_ids: url = ( f"https://{TENANT}-api.esper.cloud/api/enterprise/" f"{ENTERPRISE_ID}/device/{device_id}/?delete_seamless_info=false" ) response = requests.delete(url, headers=HEADERS) print(f"{device_id}: {response.status_code}") time.sleep(0.5) # Avoid hitting rate limits - Replace
your-tenant,your-enterprise-id, andyour-api-keywith your actual credentials. - Replace the values in
device_idswith the IDs collected in Step 1.
Step 4: Handle rate limiting
- If the API returns
429 Too Many Requests, increase the delay between requests and add retry logic:import requests import time TENANT = "your-tenant" ENTERPRISE_ID = "your-enterprise-id" API_KEY = "your-api-key" HEADERS = {"Authorization": f"Bearer {API_KEY}"} device_ids = ["device_id_1", "device_id_2", "device_id_3"] for device_id in device_ids: url = ( f"https://{TENANT}-api.esper.cloud/api/enterprise/" f"{ENTERPRISE_ID}/device/{device_id}/?delete_seamless_info=false" ) for attempt in range(3): response = requests.delete(url, headers=HEADERS) if response.status_code == 429: print(f"Rate limited. Retrying {device_id} in 10 seconds...") time.sleep(10) else: print(f"{device_id}: {response.status_code}") break time.sleep(1)
204 No Content for each device ID. After the script completes, navigate to Devices & Groups in the Esper Console and confirm the deleted devices no longer appear. For large batches, allow up to a few minutes for the Console to reflect all changes.
If this doesn't resolve it
If devices still appear in Devices & Groups after deletion, or if API requests return unexpected errors, collect the following before contacting Esper Support:
- The device IDs you attempted to delete
- The full API response body and HTTP status code for any failed requests
- Your enterprise ID and tenant name
- A screenshot of the device record in the Console if it persists after deletion
Contact Esper Support at support.esper.io with the above information.
Still need help?
If you're unable to bulk delete offline devices or encounter errors during the process, submit a support ticket and include the number of devices you're attempting to delete, whether you're using the Console or API, and any error messages you received.
Please sign in to leave a comment.
Comments
0 comments