---
name: "getCommandCache"
mode: "api"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
---

## getCommandCache

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.5

> 💡 This API relies on cloud capabilities. Configure authorization in the [Mini App Developer Platform](https://platform.tuya.com/miniapp/) under Development Settings - Cloud Capabilities.

### Description

Query the pending commands (DP set) cached in the cloud for the specified device. Supports Wi-Fi and ZigBee devices.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `GetCommandCacheParams` | Yes | Request body |

### Return Value

Type: `Promise<CommandCache[]>`

CommandCache array; see this type’s comments for element fields

##### CommandCache

| Property | Type | Description |
| --- | --- | --- |
| `dps` | `Record<string, unknown>` | DP key-value pairs |
| `pushStatus` | `boolean` | Whether it has been synced to the device |

### Referenced Types

##### `interface` GetCommandCacheParams

| Property | Type | Description |
| --- | --- | --- |
| `devId` | `string` | Device ID |


### Examples

#### Request example

```typescript
import { getCommandCache } from '@tuya-miniapp/cloud-api';

const result = await getCommandCache({
  devId: 'your_device_id',
});
```

#### Response example

```json
[
  {
    "dps": {
      "switch_1": true
    },
    "pushStatus": false
  },
  {
    "dps": {
      "switch_2": true
    },
    "pushStatus": true
  }
]
```
