---
title: API Capabilities
---

## Concept

Miniapp capabilities are designed with a modular approach and delivered to developers in Kit form. This enables you to easily connect to the Tuya ecosystem by integrating with the Kit.

## Cloud Capabilities

Mini programs can utilize cloud-based value-added services through a subscription and authorization mechanism, including various capabilities such as statistical charts, device logs, weather services, and biological rhythms, to help developers meet their needs.

### Cloud Capability Packages

- [Mini Program Weather Capability](/en/miniapp/develop/ray/api/weather)
- [Mini Program Lighting Scene Library Capability](/en/miniapp/develop/ray/api/light/light-library)
- [Mini Program Biological Rhythms Capability](/en/miniapp/develop/ray/api/light/light-rhythms)
- [Mini Program Device Logs Capability](/en/miniapp/develop/ray/api/logs)
- [Mini Program Location Service Capability](/en/miniapp/develop/ray/api/outdoors)
- [Mini Program Statistical Charts Capability (requires quick work order opening for statistics)](/en/miniapp/develop/ray/api/meature)
  - <font color="red">Note: To use the Mini Program Statistical Charts Capability, you need to submit a work order to enable product data statistics. Please [submit a quick work order](https://service.console.tuya.com/8/3/list?source=support_center) before use.</font>
- [Mini Program Intelligent Development Capability](/en/miniapp/develop/ray/api/ai/aiAgent/getAI2AgentConfigLangList)
- More...

### Using Cloud Capabilities

> <font color="red">Before developers can use cloud capabilities, they need to authorize configuration in the [Mini Program Developer Platform](https://iot.tuya.com/miniapp/)`Development Settings`-`Cloud Capabilities`.</font>

#### 1. Subscribe to Resource Packages（Some cloud capabilities do not require a subscription, you can skip this step and proceed to the second step of authorization）

> Choose the required capability to subscribe to cloud capability value-added service resource packages.

<Image src="/images/api/cloud/cloud_1.en.jpg"  style={{ width: 300 }}/>

#### 2. Authorization

<Image src="/images/api/cloud/cloud_2.en.jpg"  style={{ width: 300 }}/>

#### 3. After Authorization

> The authorized cloud capabilities can be viewed in the authorized cloud capabilities section.

<Image src="/images/api/cloud/cloud_3.en.jpg"  style={{ width: 300 }}/>

#### 4. View Details

> Developers need to carefully review the documentation for using cloud capabilities and pay attention to the expiration date of cloud capability resource package subscriptions and renew them in a timely manner.

<Image src="/images/api/cloud/cloud_4.en.jpg"  style={{ width: 300 }}/>

## Kit Capability packages

| Category                                                                 | Package name |
| ------------------------------------------------------------------------ | ------------ |
| Basic capabilities                                                       | BaseKit      |
| Miniapp container capabilities                                           | MiniKit      |
| Tuya's internal basic capabilities and fine-grained general capabilities | BizKit       |
| Device control capabilities                                              | DeviceKit    |
| Home management capabilities, such as getting home information.          | HomeKit      |
| Media and voice capabilities, such as music sync.                        | MediaKit     |
| Map and positioning capabilities                                         | MapKit       |
| Robot vacuum capabilities                                                | P2PKit       |

### Usage

#### Configure extension capabilities

You can use Tuya MiniApp IDE to manually configure extension capabilities for your miniapp as required. MiniKit will be automatically imported as the basic capability to run the miniapp container.

In terms of the Kit versions, we recommend that you choose those marked as **recommended**.

<Image src="/images/ide/kit-config.png"/>

### Use Kit capabilities

1. You can use `ty.func()` to import `BaseKit, BizKit, and MiniKit` as a basic capability plug-in.

   For example, you can use `hideTabBar` as a BaseKit capability, as shown in the following example:

   ```js
   ty.hideTabBar({
     animation: xxx,
   });
   ```

2. Except for `BaseKit, BizKit, and MiniKit`, other Kits must be prefixed with a namespace before they can be used.

   **To get the namespace, remove the word `Kit` from the name and then lowercase the first letter. For example, the namespace for HomeKit is home.**

   `getCurrentHomeInfo` is a HomeKit capability. Here is how it is used.

   ```js
   ty.home.getCurrentHomeInfo({
     success(homeInfo) {},
   });
   ```

#### Select a Kit version

The Kit versions that you select determine whether your miniapp can run on the specified app.

### Mobile apps and miniapps

When users scan the QR code of a miniapp with an app or tap a device on the app to run a miniapp, the system compares the existing environment settings of the app with those required by the miniapp. The miniapp can only start if the system is compatible.

The comparison rules involve:

- Base library versions
- Types and versions of Kit packages

Therefore, whether the miniapp can start and run depends on the respective **base library versions, and types and versions of Kit packages**.

### Comparison of base library versions

A **base library of a miniapp** is the container responsible for loading the miniapp framework, and provides standard components and standard APIs required by the miniapp framework. For more information, see [Base Library](/en/miniapp/log/changelog).

Each app integrates with a container or SDK of an unchanged version. The container version is further associated with multiple base library versions of the miniapp. Example:

App container version 2.4.1 can be associated with the following multiple base library versions: 2.2.4, 2.2.3, 2.1.20, 2.1.19, and 2.1.18.

**Changes in the minor versions of the base libraries are backward compatible. As a result, the app will pull the latest associated base library version to run the miniapp.**

If the base library version required by your miniapp is earlier than the latest base library version associated with the current app, backward compatibility is achieved.

If the current container version of the app is **2.4.1**, and the latest associated base library version is **2.2.4**:

1. ✅ When the miniapp requires the base library version **2.1.15**, the app pulls the base library version **2.2.4** to run the miniapp.
2. ❌ When the miniapp requires the base library version **1.2.30**, its major version differs from that of the app's associated base library. So the miniapp cannot be started due to incompatibility.
3. ❌ When the miniapp requires the base library version **2.4.0**, this required version is later than the latest base library version associated with the app. So the miniapp cannot be started due to incompatibility.

### Comparison of Kit packages

**Kit packages** are designed to provide you with extension capabilities by means of Kits.

Each app integrates with Kits of unchanged types and versions. Backward compatibility is applicable to the minor versions of the Kits.

Before a miniapp is started, the system compares the types and versions of the Kits integrated into the app with those required by the miniapp. If backward compatibility is achieved, the miniapp can be started.

In the following example, the listed Kits are integrated into the app.

| Kit     | version |
| ------- | ------- |
| BaseKit | 2.2.3   |
| MiniKit | 2.3.8   |
| TYKit   | 2.1.4   |

1. ✅ When the miniapp requires **BaseKit 2.1.2, MiniKit 2.3.7, and TYKit 2.0.7**, these required types of Kits with compatible versions are already integrated into the app. So the miniapp can be started.
2. ❌ When the miniapp requires **BaseKit 2.1.2, MiniKit 2.3.7, TYKit 2.0.7, DeviceKit 2.1.6**, DeviceKit is not integrated into the app. So the miniapp cannot be started.
3. ❌ When the miniapp requires **BaseKit 2.1.2 and MiniKit 2.4.0**, the required MiniKit version is later than that integrated into the app. So the miniapp cannot be started.

### View version details in the app

You can check the details of the container version and Kit versions in the app. In the top right corner of the miniapp, tap and hold the **Close** button for 10 seconds to bring up version details.

In the dialog box, the existing base library versions and Kit versions of the app are listed.

<Image
  src='/images/guide/environment-config/x-button.en-US.png'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '375px',
    maxHeight: '667px',
  }}
/>
