# Primo Documentation: English Developers API Reference Devices ## Devices - [Get all devices (deprecated)](https://docs.getprimo.com/api-reference/devices/get-all-devices-deprecated.md): **Deprecated** — use `getDevices` (`POST /devices/search`) instead, which returns the same device objects and additionally accepts a filter and a free-text search. This route will be removed on 2026-11-01. Return the paginated list of devices for your company, retired ones excluded, as JSON. - [Create a device](https://docs.getprimo.com/api-reference/devices/create-a-device.md): Create a new device in your company. - [Update several devices](https://docs.getprimo.com/api-reference/devices/update-several-devices.md): Update the inventory data of MULTIPLE devices in one call — the batch form of `updateDevice`, with the same fields and the same rules per device. Provide a list of `items`, each targeting one `deviceId` (up to 100 per call, each device at most once). Writes are independent and best-effort: the call… - [Export devices as CSV](https://docs.getprimo.com/api-reference/devices/export-devices-as-csv.md): Export the devices of your company as a paginated CSV (one row per device, first line is the header, up to 1000 devices per page). To send an inventory of devices and the employees holding them, with no device code, use `exportInventory` instead. Each row contains the device attributes (IMEIs includ… - [Export the device and employee inventory as CSV](https://docs.getprimo.com/api-reference/devices/export-the-device-and-employee-inventory-as-csv.md): Export the inventory of your company as a paginated CSV of devices and the employees holding them, up to 1000 rows per page. It carries no device code (recovery key, unlock PIN, bypass code, password) and no personal email, phone or address, so the file can be sent outside IT. To export every device… - [Get the device search filter catalog](https://docs.getprimo.com/api-reference/devices/get-the-device-search-filter-catalog.md): Return every criterion a device filter accepts — each with its `key`, `valueType`, allowed operations and live company values — plus the custom fields defined for devices. This is the vocabulary for `getDevices`: use a criterion's `key` as the filter key and one of its `values` inside the clause (`{… - [Get a device by ID](https://docs.getprimo.com/api-reference/devices/get-a-device-by-id.md): Return the device details for the given device ID, including its `imeis` (IMEIs, digits only, one per SIM slot, reported for company-owned iPhones, cellular iPads and Android phones) and its `macAddress` (the MAC of the interface carrying its default route, reported for computers), which `getDevices… - [Delete a device](https://docs.getprimo.com/api-reference/devices/delete-a-device.md): Permanently delete a device from your company. The device must not be enrolled. - [Update a device](https://docs.getprimo.com/api-reference/devices/update-a-device.md): Update the inventory data of one device: its assignee, its identity and specs, and its purchase data. Only the fields present in the body are changed — each field documents its own constraints. Fields that MDM reports for an enrolled device can only be set while the device is not enrolled; changing… - [Lock a device](https://docs.getprimo.com/api-reference/devices/lock-a-device.md): Lock the device for the given device ID. - [Unlock a device](https://docs.getprimo.com/api-reference/devices/unlock-a-device.md): Unlock the device for the given device ID. - [Wipe a device](https://docs.getprimo.com/api-reference/devices/wipe-a-device.md): Wipe the device for the given device ID. - [Run a script on one device](https://docs.getprimo.com/api-reference/devices/run-a-script-on-one-device.md): Run a script on the device for the given device ID. Pass `{ "scriptId": 12 }` to run a saved script (see `getScripts`), or `{ "contents": "..." }` to send the source inline. - [List a device's script history](https://docs.getprimo.com/api-reference/devices/list-a-devices-script-history.md): Return the paginated script executions that reached this device, newest first — across every run, including company-wide and device-group runs launched elsewhere. Each entry carries the script that ran plus its status, output, exit code and runtime. Use this to answer "what has been run on this mach… - [Retire a device](https://docs.getprimo.com/api-reference/devices/retire-a-device.md): Retire (decommission) a device: it is unassigned from its owner, renamed to `deviceName`, marked retired and taken out of stock, with `condition` and `notes` recorded; `putDeviceBackInStock` reverts it. The device must not be enrolled in MDM: an enrolled device is refused with 409, but the unassignm… - [Reboot a device](https://docs.getprimo.com/api-reference/devices/reboot-a-device.md): Trigger a reboot on the device. The command is sent the next time the device comes online. - [Disenroll a device](https://docs.getprimo.com/api-reference/devices/disenroll-a-device.md): Disenroll the device from MDM; once done, the device is no longer managed. Android is disenrolled immediately. On macOS, Windows and Linux a removal script runs when the device next checks in, so it still reads as enrolled until then; other platforms cannot be disenrolled remotely and are refused wi… - [Move a device to stock](https://docs.getprimo.com/api-reference/devices/move-a-device-to-stock.md): Move the device to stock (unassign it from any employee). - [Move a device to in-use](https://docs.getprimo.com/api-reference/devices/move-a-device-to-in-use.md): Move the device from stock back to in-use status. - [Put a device back in stock](https://docs.getprimo.com/api-reference/devices/put-a-device-back-in-stock.md): Cancel a pending retirement and return the device to stock. - [Update a device owner](https://docs.getprimo.com/api-reference/devices/update-a-device-owner.md): Assign or unassign a device to an employee. Pass null to unassign. - [Update device tags](https://docs.getprimo.com/api-reference/devices/update-device-tags.md): Replace the tags on a device with the provided list. - [Get device events](https://docs.getprimo.com/api-reference/devices/get-device-events.md): Return the list of lifecycle events recorded by Primo for the given device (lock, wipe, reboot, disenroll, etc.) in reverse chronological order. For the MDM activity feed reported by the MDM layer, use `getDeviceActivities`; for raw MDM protocol commands and their delivery status, use `getDeviceComm… - [List local user accounts on a device](https://docs.getprimo.com/api-reference/devices/list-local-user-accounts-on-a-device.md): Return the local user accounts provisioned on ONE device, each with its privilege level (`rights`: ADMIN / USER / UNKNOWN). Use this to find which accounts hold local administrator or standard user rights on a machine. For many devices at once, use `getDevicesUsers` instead of calling this endpoint… - [List local user accounts on multiple devices](https://docs.getprimo.com/api-reference/devices/list-local-user-accounts-on-multiple-devices.md): Return the local user accounts provisioned on MULTIPLE devices in one call, grouped by device id, each account with its privilege level (`rights`: ADMIN / USER / UNKNOWN). Use this to answer fleet-wide questions such as "which users hold local administrator rights on their machine": list the devices… - [Get device code history](https://docs.getprimo.com/api-reference/devices/get-device-code-history.md): Return the decrypted code history for ONE device (recovery key, iCloud bypass code, unlock PIN, recovery OS password), newest first. Optionally filter by `type`. For many devices at once, use `getDevicesCodeHistory` instead of calling this endpoint in a loop. - [Get device reachability](https://docs.getprimo.com/api-reference/devices/get-device-reachability.md): Return how reachable ONE device was over the last 7 days, from its Fleet check-ins counted in 5-minute buckets: `reachabilityPercent` (share of the buckets in which the device checked in, 0 to 100, null before its first check-in) and `samples` (one `{ slotStartedAt, isOnline, onlinePercent }` per 30… - [Get code history for multiple devices](https://docs.getprimo.com/api-reference/devices/get-code-history-for-multiple-devices.md): Return the decrypted code history (recovery key, iCloud bypass code, unlock PIN, recovery OS password) for MULTIPLE devices in one call, grouped by device id, each newest first. Provide a list of `deviceIds` (up to 200 per call), optionally filtered by `type`. Devices that do not exist, or that do n… - [Get device custom fields](https://docs.getprimo.com/api-reference/devices/get-device-custom-fields.md): Return all Active custom field definitions for ONE device, each paired with the current stored value (or null when unset). For SELECT / MULTI_SELECT fields the `options` catalog is included so you can map option ids to labels. For many devices at once, use `getDevicesCustomFields` instead of calling… - [Get custom fields for multiple devices](https://docs.getprimo.com/api-reference/devices/get-custom-fields-for-multiple-devices.md): Return all Active custom field definitions for MULTIPLE devices in one call, each paired with the current stored value (or null when unset), grouped by device id. Provide a list of `deviceIds` (up to 500 per call). Prefer this over calling `getDeviceCustomFields` once per device. - [Set a device custom field value](https://docs.getprimo.com/api-reference/devices/set-a-device-custom-field-value.md): Set or overwrite a custom field value on a device. Idempotent. Returns the updated field (definition + value). For SELECT supply the option id (string); for MULTI_SELECT supply an array of option ids. Option ids can be read from the `getDeviceCustomFields` endpoint. - [Clear a device custom field value](https://docs.getprimo.com/api-reference/devices/clear-a-device-custom-field-value.md): Remove the stored value for a custom field on a device. Returns the updated field (value reset to null). - [Get devices, optionally narrowed by a filter](https://docs.getprimo.com/api-reference/devices/get-devices-optionally-narrowed-by-a-filter.md): Return the devices of your company as a paginated JSON list of full device objects — use it to look up, filter or answer questions about the devices themselves. Send an empty body to list everything; add a `filter` to narrow it. Every `filter` entry is keyed by a `key` from `getDeviceFilterCatalog`… - [Count devices for up to 20 filters in one call](https://docs.getprimo.com/api-reference/devices/count-devices-for-up-to-20-filters-in-one-call.md): Return only numbers: `{"counts":{"