# List Devices

> Source: https://truto.one/docs/api-reference/unified-mdm-api/devices/list/

`GET /unified/mdm/devices`

Resource: **Devices** · API: **Unified MDM API**

## Supported integrations

Jamf (partial), Kandji, Ninjaone

## Query parameters

- **`integrated_account_id`** _(string, required)_
  The ID of the integrated account to use for the request.
- **`truto_response_format`** _(string)_
  The format of the response. - `unified` returns the response with unified mappings applied. - `raw` returns the unprocessed, raw response from the remote API. - `normalized` applies the unified mappings and returns the data in a normalized format. - `stream` returns the response as a stream, which is ideal for transmitting large datasets, files, or binary data. Using streaming mode helps to efficiently handle large payloads or real-time data flows without requiring the entire data to be buffered in memory. Defaults to `unified`.
  Allowed: `unified`, `raw`, `normalized`, `stream`
- **`truto_key_by`** _(string)_
  By default the `result` attribute is an array of objects. This parameter allows you to specify a field in each `result` objects to use as key, which transforms the `result` array into an object with the array items keyed by the field. This is useful for when you want to use the result as a lookup table.
- **`truto_ignore_limit`** _(boolean)_
  Ignores the `limit` query parameter.
- **`truto_ignore_remote_data`** _(boolean)_
  Excludes the `remote_data` attribute from the response.
- **`truto_exclude_fields`** _(array<string>)_
  Array of fields to exclude from the response.
- **`remote_query`** _(object)_
  Query parameters to pass to the underlying API without any transformations. Refer [this guide](https://truto.one/docs/api-reference/overview/querying#remote-query-parameters) to see how to structure the query parameters.
- **`name`** _(string)_
  Pass this value only when type is mobile.
- **`type`** _(string)_
  The type/category of the device
  Allowed: `desktop`, `laptop`, `mobile`, `other`, `server`, `tablet`, `virtual_machine`, `workstation`
- **`model`** _(string)_
  The hardware model of the device
- **`os_version`** _(string)_
  The operating system version
- **`platform`** _(string)_
  The platform family of the device
  Allowed: `android`, `chromeos`, `ios`, `ipados`, `linux`, `macos`, `unknown`, `windows`
- **`serial_number`** _(string)_
  The serial number of the device
- **`tags`** _(array<object>)_
  The device's tags
- **`owner`** _(object)_
  The assigned owner of the device
- **`policy`** _(object)_
  The applied policy / blueprint
- **`organization`** _(object)_
  The organization/account the device belongs to

## Response body

- **`result`** _(array<object>)_
  List of Devices
  - **`id`** _(string, required)_
    The unique identifier for the device
  - **`name`** _(string)_
    The display name of the device
  - **`hostname`** _(string)_
    The host/system name of the device
  - **`dns_name`** _(string)_
    The DNS name of the device
  - **`netbios_name`** _(string)_
    The NetBIOS name of the device (Windows)
  - **`type`** _(string)_
    The type/category of the device
    Allowed: `workstation`, `server`, `mobile`, `tablet`, `laptop`, `desktop`, `virtual_machine`, `other`
  - **`is_corporate_owned`** _(boolean)_
    Whether the device is corporate-owned (as opposed to personally-owned/BYOD)
  - **`platform`** _(string)_
    The platform family of the device
    Allowed: `windows`, `macos`, `linux`, `ios`, `ipados`, `android`, `chromeos`, `unknown`
  - **`model`** _(string)_
    The hardware model of the device
  - **`manufacturer`** _(string)_
    The hardware manufacturer of the device
  - **`serial_number`** _(string)_
    The serial number of the device
  - **`asset_tag`** _(string)_
    The asset tag / inventory tag of the device
  - **`os_name`** _(string)_
    The operating system name
  - **`os_version`** _(string)_
    The operating system version
  - **`os_build`** _(string)_
    The operating system build identifier
  - **`os_version_extra`** _(string)_
    Additional operating system version information
  - **`disk_encryption`** _(boolean)_
    Whether the disk encryption is enabled on the device
  - **`firewall_enabled`** _(boolean)_
    Whether the host firewall is enabled on the device
  - **`mdm_enabled`** _(boolean)_
    Whether MDM management is enabled on the device
  - **`agent_installed`** _(boolean)_
    Whether a management agent is installed
  - **`agent_version`** _(string)_
    The management agent version
  - **`enrollment_status`** _(string)_
    Enrollment state of the device in the provider
    Allowed: `enrolled`, `pending`, `removed`, `missing`, `unknown`
  - **`approval_status`** _(string)_
    Approval state if the provider requires approval
    Allowed: `approved`, `pending`, `rejected`, `unknown`
  - **`is_offline`** _(boolean)_
    Whether the device is currently offline
  - **`first_enrolled_at`** _(string)_
    The date and time the device was first enrolled
  - **`last_enrolled_at`** _(string)_
    The date and time the device was most recently enrolled
  - **`last_scan_at`** _(string)_
    The date and time the device was last scanned for vulnerabilities or security posture signals, when supported by the underlying product
  - **`last_activity_at`** _(string)_
    The date and time of the last recorded activity for the device
  - **`organization`** _(object)_
    The organization/account the device belongs to
    - **`id`** _(string)_
      The unique identifier for an organization
    - **`name`** _(string)_
      The name of the organization
  - **`owner`** _(object)_
    The assigned owner of the device
    - **`id`** _(string)_
      The unique identifier for a user
    - **`name`** _(string)_
      The name of the user
    - **`emails`** _(array<object>)_
      The emails of the user
      - **`email`** _(string)_
        The email address
      - **`type`** _(string)_
        The type of email address
      - **`is_primary`** _(boolean)_
        Whether the email address is primary
  - **`policy`** _(object)_
    The applied policy / blueprint
    - **`id`** _(string)_
      The unique identifier for a policy
    - **`name`** _(string)_
      The name of the policy
  - **`edr_installed`** _(boolean)_
    Whether an endpoint detection and response (EDR) agent is installed or detected on the device
  - **`edr_status`** _(string)_
    The health/status of the EDR agent on the device, when available from the underlying product
    Allowed: `healthy`, `unhealthy`, `degraded`, `unknown`
  - **`critical_vuln_count`** _(integer)_
    The number of critical severity vulnerabilities detected on the device
  - **`high_vuln_count`** _(integer)_
    The number of high severity vulnerabilities detected on the device
  - **`patch_status`** _(string)_
    The patch compliance status of the device, based on signals available in the underlying product
    Allowed: `up_to_date`, `updates_available`, `unknown`
  - **`maintenance_status`** _(string)_
    The maintenance status
    Allowed: `none`, `pending`, `active`, `completed`, `unknown`
  - **`maintenance_start_at`** _(string)_
    The date and time maintenance starts
  - **`maintenance_end_at`** _(string)_
    The date and time maintenance ends
  - **`maintenance_reason`** _(string)_
    The maintenance reason message
  - **`warranty_start_at`** _(string)_
    The date and time warranty starts
  - **`warranty_end_at`** _(string)_
    The date and time warranty ends
  - **`warranty_fulfillment_at`** _(string)_
    The manufacturer fulfillment date
  - **`backup_last_success_at`** _(string)_
    The date and time the last backup succeeded
  - **`backup_last_failure_at`** _(string)_
    The date and time the last backup failed
  - **`backup_total_bytes`** _(number)_
    Total backup usage in bytes
  - **`public_ip`** _(string)_
    The public IP address of the device
  - **`ip_addresses`** _(array<string>)_
    The private IP addresses of the device
  - **`mac_addresses`** _(array<string>)_
    The MAC addresses of the device
  - **`tags`** _(array<object>)_
    The device's tags
    - **`id`** _(string)_
      The tag's unique identifier
    - **`name`** _(string)_
      The tag's name
  - **`notes`** _(array<object>)_
    Notes attached to the device
    - **`id`** _(string, required)_
      The note's unique identifier
    - **`title`** _(string)_
      The note's title
    - **`owner`** _(object)_
      The note's owner
      - **`id`** _(string)_
        The note's owner's unique identifier
    - **`content`** _(string)_
      The note's content
  - **`custom_fields`** _(object)_
    Provider or customer specific fields mapped into a flexible key-value object
  - **`created_at`** _(string)_
    The date and time the device record was created
  - **`updated_at`** _(string)_
    The date and time the device record was last updated
  - **`remote_data`** _(object)_
    Raw data returned from the remote API call.
- **`next_cursor`** _(string)_
  The cursor to use for the next page of results. Pass this value as `next_cursor` in the query parameter in the next request to get the next page of results.

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/unified/mdm/devices?integrated_account_id=<integrated_account_id>' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const integratedAccountId = '<integrated_account_id>';

const response = await fetch(`https://api.truto.one/unified/mdm/devices?integrated_account_id=${integratedAccountId}`, {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/unified/mdm/devices"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
    "integrated_account_id": "<integrated_account_id>"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const result = await truto.unifiedApi.list(
  'mdm',
  'devices',
  { integrated_account_id: '<integrated_account_id>' }
);

console.log(result);
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    async for item in truto_api.unified_api.list(
        "mdm",
        "devices",
        {"integrated_account_id": "<integrated_account_id>"}
    ):
        print(item)

asyncio.run(main())
```
