# Retrieve command history for a managed device Gets the command history for the device. ## Endpoint `GET /api/v1/mdm/devices/{device_id}/commandhistory` ## Request URL `https://{serverurl}/api/v1/mdm/devices/{device_id}/commandhistory` ## Scope `MDMOnDemand.MDMInventory.READ` ## Header `Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52` ## Request Parameters ### Request Headers | Parameter | Type | Required | Value | |---|---|---|---| | Accept | string | Mandatory | `application/json` | ### Path Parameters | Parameter | Type | Required | Description | |---|---|---|---| | device_id | string | Mandatory | Unique identifier of the device. Obtain from the [Get Device List](https://www.manageengine.com/mobile-device-management/help/api/cloud/devices-get-device-list.html) response | ### Query Parameters | Parameter | Type | Required | Description | |---|---|---|---| | limit | integer | Optional | Maximum number of records to return in a single response. Used together with offset for pagination | | skip-token | string | Optional | Pagination continuation token returned by a previous response. Pass it to fetch the next page of results | | offset | integer | Optional | Zero-based index of the first record to return. Used together with limit for pagination | | delta-token | string | Optional | Token used for delta/incremental fetches. Pass the token returned from a previous response to retrieve only items modified since that point | | days | integer | Optional | Number of days to look back from the current time when filtering results | | start_time | string | Optional | Start of the time range to filter by (epoch milliseconds, inclusive) | | end_time | string | Optional | End of the time range to filter by (epoch milliseconds, inclusive) | ## Sample Request ```curl curl --request GET \ --url https://appdomain/api/v1/mdm/devices/{device_id}/commandhistory \ --header 'Accept: application/json' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' ``` ## Response Parameters ### HTTP Code 200 Response body: `application/json` | Parameter | Type | Description | |---|---|---| | metadata | JSON object | Metadata about the result set | | paging | JSON object | Pagination links for navigating results | | delta-token | string | Delta token for incremental queries | | commands | JSON array | Array of commands sent to the device | ## Possible Response Codes | Code | Type | |---|---| | 200 | HTTP code | ## Sample Response: HTTP 200 Paginated command history with lifecycle details ```json { "metadata": { "total_record_count": 4 }, "delta-token": "aHR0cDovL2xvY2FsaG9zdDo5MDIwL2FwaS92MS9tZG0vcHJvZmlsZXMvc2NlcHNldHRpbmdzOjoxNTQyOTU0OTEzOTI0", "paging": { "next": "https://appDomain/api/v1/mdm/devices/9007199254741001/commandhistory?skip-token=MjozOjE6MTU0Mjk1NDkxMzkxOA%3D%3D", "previous": "https://appDomain/api/v1/mdm/devices/9007199254741001/commandhistory?skip-token=Aexzsjk6nkL1psqmWdKigzGxOA%3D%3D" }, "commands": [ { "command_status": 2, "managed_status": 2, "command_id": 9007199254741304, "added_time": "1523370360750", "device_id": "9007199254741001", "added_by": 9007199254740996, "command_history_id": 9007199254740996, "command_life": [ { "updated_time": 1560141503246, "status_description": "Command Success", "command_id": 9007199254741304, "status_code": 2, "added_by": 9007199254740996, "command_name": "AssetScan", "added_by_name": "admin", "remarks": "--" } ], "remarks_args": null, "command_name": "AssetScan", "added_by_name": "admin", "remarks": "--" } ] } ``` ## API Rate Limit ![](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 250 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.