tencent cloud


Importing Group Members

Last updated: 2022-06-20 17:05:45

    Feature Description

    • This API is used to import group members without triggering callbacks or delivering notifications.
    • When your app needs to be migrated to IM from another instant messaging system, you can use this protocol to import existing group member data.

    API Calling Description

    Applicable group types

    Group Type Support This RESTful API
    Private Yes, identical to Work in the new version
    Public Yes
    ChatRoom Yes, identical to Meeting in the new version
    AVChatRoom No
    Community Yes.

    IM comes with the preceding four group types. For more information, see Group System.


    Generally, importing group members is not required for AVChatRoom, so AVChatRoom does not support this API. If you attempt to use API on AVChatRoom, error 10007 will be returned.

    Request URL example


    Request parameters

    The following table lists only the parameters to be modified when this API is called. For details on other parameters, see RESTful API Overview.

    Parameter Description
    https The request protocol is HTTPS, and the request method is POST.
    xxxxxx The country/region where your SDKAppID is located.
  • China: console.tim.qq.com
  • Singapore: adminapisgp.im.qcloud.com
  • Seoul: adminapikr.im.qcloud.com
  • Frankfurt: adminapiger.im.qcloud.com
  • India: adminapiind.im.qcloud.com
  • v4/group_open_http_svc/import_group_member Request API
    sdkappid SDKAppID assigned by the IM console when an app is created
    identifier This must be the app admin account. For details, see App Admins.
    usersig Signature generated by the app admin account. For details, see Generating UserSig.
    random A random 32-bit unsigned integer ranging from 0 to 4,294,967,295
    contenttype Request format. The value is always json.

    Maximum calling frequency

    The maximum calling frequency is 200 times per second.

    Request packet example

    Request packets are used to import group members. A single request supports the import of a maximum of 300 members. If the unread message count specified by this API is greater than the current number of messages of the group, the unread message count is set to the current number of messages of the group.


    Ensure that the join time of the member to be imported is later than the group creation time and earlier than the current time. Otherwise, the member cannot be imported.

      "GroupId": "@TGS#2J4SZEAEL", // Target group (required)
      "MemberList": [ // A maximum of 300 members can be added at a time.
          "Member_Account": "tommy" // ID of the group member to be added (required)
          "Role":"Admin", // Role of the group member to be imported. Currently, the only supported role is Admin (optional).
          "JoinTime":1448357837, // Time when the group member to be imported joined the group (optional)
          "UnreadMsgNum":5 // Unread message count of this member (optional)
          "Member_Account": "jared",

    Request packet fields

    Field Type Property Description
    GroupId String Required ID of the target group
    MemberList Array Required Array of the group members to be added
    Member_Account String Required Group member accounts to be imported
    Role String Optional Role of the group member to be imported. Currently, only Admin is supported. If this field is not specified, the member is regarded as a common member.
    JoinTime Integer Optional Time when the group member to be imported joined the group
    UnreadMsgNum Integer Optional Unread message count of the group member to be imported

    Response packet example

      "ActionStatus": "OK",
      "ErrorInfo": "",
      "ErrorCode": 0,
      "MemberList": [
           "Member_Account": "tommy",
           "Result": 1 // Result of the import. 0: failed. 1: succeeded. 2: already a group member.
           "Member_Account": "jared",
           "Result": 1

    Response packet fields

    Field Type Description
    ActionStatus String Request processing result. OK: succeeded. FAIL: failed.
    ErrorCode Integer Error code. 0: succeeded. Others: failed.
    ErrorInfo String Error information
    MemberList Array List of added group members
    Member_Account String Returned group member accounts
    Result Integer Result of the import. 0: failed. 1: succeeded. 2: already a group member.

    Error Codes

    Unless a network error (such as error 502) occurs, the HTTP return code of this API is always 200. The actual error code and error information are represented by ErrorCode and ErrorInfo in the response packet, respectively.
    For common error codes (60000 to 79999), see Error Codes.
    The private error codes for this API are as follows:

    Error Code Description
    10002 An internal server error occurred. To correct it, try again.
    10003 The request command word is invalid.
    10004 A request parameters is invalid. To correct it, check whether request parameters are correct based on the error description.
    10005 The request packet carries too many accounts.
    10006 The operation frequency limit has been reached. To correct it, reduce the frequency of calls.
    10007 The user does not have sufficient operation permissions. For example, a common member in a public group attempts to remove a member from the group, but only the app admin has the permission to do so.
    10010 The group does not exist or has been dismissed.
    10015 The group ID is invalid. To correct it, check whether the group ID is correct.

    API Debugging Tools

    Use the online debugging tool for RESTful APIs to debug this API.


    Deleting group members v4/group_open_http_svc/delete_group_member)

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support