Device Groups

View Markdown

Last edited on 2026-08-10

For scenarios requiring batch operations on devices, you can use device groups.

1. Device Group Limitations

  • A device group can contain a maximum of 50 devices by default. A device can only belong to one device group.
  • Expanded capacity groups can be used if the requirements for large-capacity device groups are met.
  • All devices within the same device group must belong to the same device type (model_type), such as "Campus Phone", but they do not necessarily have to be the same device model (model_id).
  • Device groups must be created via the backend API. Once created, modifying the device group name is not allowed. The name displayed during user authorization and when answering calls is the device group name, which cannot be customized per user.

2. Manage Device Groups

Developers can perform CRUD operations on device groups through the following backend APIs.

Developers must maintain the group_id of all created device groups for subsequent queries and authorization. WeChat only performs validation and does not maintain the list of all group_ids created by the Mini Program

Note:

Except when adding devices during group creation, adding or removing devices should generally only occur in scenarios such as purchasing additional devices, replacing damaged devices, or decommissioning devices. Developers should keep the device composition within a group relatively stable and avoid frequent changes to the group's composition.

WeChat monitors device group operations and may require Mini Program administrators to provide manual confirmation when necessary. In such cases, the device group operations will take effect after administrator confirmation.

3. Use Cases

Currently applicable to the Batch Device Authorization scenario.

4. Troubleshooting Guide

4.1 Why can't I find the device in the device group if it was added previously?

  • The removeIotGroupDevice logic might have been invoked by other processes, removing the device from the device group;
  • The device might have been forcibly transferred to another device group via addIotGroupDevice (force_add=true) from another location, which also results in its removal from the previous group.

4.2 How to troubleshoot if the device is still reported as unauthorized (errCode = 9) after the user authorizes the device group?

If a device using a device group is reported as unauthorized, the following possibilities may apply:

  • The user has not authorized the device group, or the user has cleared or revoked the authorization after previously granting it Clearing or revoking authorization.
    • You can use the Authorization Status Query API to determine whether an authorization relationship exists between the user and the device/device group.
  • The user has authorized the device group, but the device in question is not included in the device group.
    • You can use getIotGroupInfo to query the list of devices in the device group.

4.3 Both User A and User B have authorized Device Group X, but User A can reach Device X1 within the group while User B cannot?

This is generally because User A has an existing direct authorization with the device (not through the Device Group). Assume that Device X1 exists in Device Group X.

  • User A has authorized both Device Group X and Device X1 directly. In this case, even if Device X1 is removed from Device Group X, User A can still call the device.
  • User B has only authorized Device Group X. In this case, once Device X1 is removed from Device Group X, User B cannot call the device.