---
name: "upgradeToLatestLightLibrariesVersions"
mode: "api"
versionRequirements:
  - { name: "MiniKit", version: "3.7.6" }
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
  - { name: "Mini Program Base Library", version: "2.18.1" }
---

## upgradeToLatestLightLibrariesVersions

> [VERSION] MiniKit >= 3.7.6 | @tuya-miniapp/cloud-api >= 1.0.5 | Mini Program Base Library >= 2.18.1

> 💡 This API is a cloud capability and requires authorization before use. For details on cloud capabilities, see the [documentation](/cn/miniapp/common/desc/tech-stack/api). Currently, cloud capabilities are not available in the Developer Tools environment; you must package the app or debug on a real device. The [Lighting Scene Library](https://developer.tuya.com/cn/docs/iot/scene_library?id=Kbn3oiww4klzq) can be used only after Advanced Capabilities are enabled on the Tuya Developer Platform Product Function Definition page; otherwise, cloud capability calls will fail.

### Description

When an updatable version is detected, use this API to upgrade the library to the latest version. If libDataType is 0, it will attempt to update all data types to the latest version.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `GetLightLibrariesDataParams` | Yes | Request parameters: bizId (business ID), bizType (business type: 0 = device, 1 = group), libType (library type: SCENE_LIB = scene library, MUSIC_LIB = music library, SCENE_IMAGE_LIB = scene image library), libDataType (library data type: 0 = all; if 0, the library is considered updatable if any data type has updates; 1 = basic data, provided by Tuya and bound at the panel uiId level; 2 = advanced data, maintained by users in the micro app backend). |

### Return Value

Type: `Promise<boolean>`

boolean

### Referenced Types

##### `interface` GetLightLibrariesDataParams

| Property | Type | Description |
| --- | --- | --- |
| `bizId` | `string` | Business ID |
| `bizType` | `0 \| 1` | Business type: 0 = device, 1 = group |
| `libType` | `"SCENE_LIB" \| "MUSIC_LIB" \| "SCENE_IMAGE_LIB"` | Library type. SCENE_LIB: scene library. MUSIC_LIB: music library. SCENE_IMAGE_LIB: scene image library. |
| `libDataType` | `0 \| 1 \| 2` | Library data type. 0: all. If 0, the library is considered updatable when any data type has updates. 1: basic data—provided by Tuya and bound at the panel uiId level. 2: advanced data—maintained by users in the micro app backend. |


### Examples

#### Request example

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

upgradeToLatestLightLibrariesVersions({
  bizId: 'vdevo167504******003',
  bizType: 0,
  libType: 'SCENE_LIB',
  libDataType: 0,
})
  .then((response) => {
    console.log(response);
  })
  .catch();
```

#### Response example

```json
true
```
