please select
  • UIKit
  • SDK
  • Server APIs
Chat/
Server APIs/
RESTful APIs/
Group Related/
Group Management/
Server APIs
  • Generating UserSig
  • RESTful APIs
    • RESTful API Overview
    • RESTful API List
    • Message Related
      • Send Message
        • Sending One-to-One Messages to One User
        • Sending One-to-One Messages to Multiple Users
        • Sending Ordinary Messages in a Group
        • Sending System Messages in a Group
        • Broadcast Message of Audio-Video Group
        • Importing One-to-One Messages
        • Importing Group Messages
      • Historical Message
        • Modifying Historical One-to-one Messages
        • Modifying Historical Group Messages
        • Pulling Historical One-to-one Messages
        • Pulling Historical Group Messages
      • Delete Message
        • Deleting Messages Sent by a Specified User
      • Withdraw Message
        • Recalling One-to-One Messages
        • Recalling Group Messages
      • Read Receipt
        • Marking One-to-One Messages as Read
        • Pulling Group Message Read Receipt Details
        • Pulling Read Receipts for Group Messages
      • Message Extension
        • Pulling the Message Extension of a One-to-One Message
        • Configuring Message Extension for a One-to-One Message
        • Pulling Message Extension of a Group Message
        • Configuring Message Extension for a Group Message
      • Pushing to All Users
        • API for Pushing to All Users
        • Pushing to All Users
        • Setting Application Attribute Names
        • Getting Application Attribute Names
        • Getting User Attributes
        • Setting User Attributes
        • Deleting User Attributes
        • Getting User Tags
        • Adding User Tags
        • Deleting User Tags
        • Deleting All Tags of a User
    • Session Related
      • Conversation List
        • Pulling a conversation list
      • Session Unread Count
        • Setting the Unread Message Count of a Member
        • Querying Unread One-to-One Message Count
      • Delete Session
        • Deleting a conversation
      • Session Grouping Tag
        • Creating Conversation Group Data
        • Updating Conversation Group Data
        • Deleting Conversation Group Data
        • Creating or Updating Conversation Mark Data
        • Searching for Conversation Group Marks
        • Pulling Conversation Group Mark Data
    • Group Related
      • Group Management
        • Getting All Groups in an App
        • Creating a Group
        • Disbanding a Group
        • Getting the Groups a User Has Joined
      • Group Information
        • Getting Group Profiles
        • Modifying the Profile of a Group
        • Importing a Group Profile
      • Group Member Management
        • Adding Group Members
        • Deleting Group Members
        • Banning Group Members
        • Unbanning Group Members
        • Bulk Muting and Unmuting
        • Getting the List of Muted Group Members
        • Changing Group Owner
        • Querying the Roles of Users in a Group
        • Importing Group Members
      • Group Member Information
        • Getting Group Member Profiles
        • Modifying the Profile of a Group Member
      • Group Custom Attributes
        • Getting Group Custom Attributes
        • Modifying Group Custom Attributes
        • Clearing Group Custom Attributes
        • Resetting Group Custom Attributes
        • Deleting Group Custom Attributes
      • Live Group Management
        • Getting the Number of Online Users in an Audio-Video Group
        • Getting the List of Online Members in Audio-Video Group
        • Setting Audio-Video Group Member Marks
        • Getting the List of Banned Group Members.
      • Community Management
        • Creating Topic
        • Deleting Topic
        • Getting Topic Profile
        • Modifying Topic Profile
        • Importing Topic Profiles
      • Group Counter
        • Getting Group Counters
        • Updating Group Counters
        • Deleting Group Counters
    • User Management
      • Account Management
        • Importing a Single Account
        • Importing Multiple Accounts
        • Deleting Accounts
        • Querying Accounts
      • User Information
        • Setting Profiles
        • Pulling Profiles
      • User Status
        • Invalidating Account Login States
        • Querying Account Online Status
      • Friend Management
        • Adding Friends
        • Importing Friends
        • Updating Friends
        • Deleting Friends
        • Deleting All Friends
        • Verifying Friends
        • Pulling Friends
        • Pulling Specified Friends
      • Friend Lists
        • Adding Lists
        • Deleting Lists
        • Pulling Lists
      • Blocklist
        • Blocklisting Users
        • Unblocklisting Users
        • Pulling a Blacklist
        • Verifying Users on a Blocklist
    • Global Mute Management
      • Setting Global Mute
      • Querying Global Mute
    • Operations Management
      • Pulling Operations Data
      • Downloading Recent Messages
      • Getting Server IP Addresses
    • Chatbots
      • Pulling Chatbot Accounts
      • Creating Chatbot Accounts
      • Deleting Chatbot Accounts
  • Webhooks
    • Webhook Overview
    • Webhook Command List
    • Operations Management Callbacks
      • API Overclocking Alarm Callbacks
    • Online Status Webhooks
      • Status Change Webhooks
    • Relationship Chain Webhooks
      • After a Profile Is Updated
      • Before a Friend Is Added
      • Before a Friend Request Is Responded
      • After a Friend Is Added
      • After a Friend Is Deleted
      • After a User Is Added to Blocklist
      • After a User Is Removed from Blocklist
    • One-to-One Message Webhooks
      • Before a One-to-One Message Is Sent
      • After a One-to-One Message Is Sent
      • After a One-to-One message Is Marked as Read
      • After A One-to-One Message Is Recalled
    • Group Webhooks
      • Before a Group Is Created
      • After a Group Is Created
      • Before Applying to Join a Group
      • Before Inviting a User to a Group
      • After a User Joins a Group
      • After a User Leaves a Group
      • Before Group Message Is Sent
      • After a Group Message Is Sent
      • After a Group Is Full
      • After a Group Is Disbanded
      • After Group Profile Is Modified
      • Callback After Recalling Group Messages
      • Webhook for Online and Offline Status of Audio-Video Group Members
      • Webhook for Exceptions When Group Messages Are Sent
      • Before a Topic Is Created
      • After a Topic Is Created
      • After a Topic Is Deleted
      • Topic Profile Change Webhook
      • Callback After Group Member Profile Changed
      • Callback After Group Attribute Changed
      • Callback After Read Receipt
      • Callback After the Group Owner Changed
    • Webhook Mutual Authentication Configuration Guide
      • Apache Mutual Authentication Configuration
      • Nginx Mutual Authentication Configuration
    • Chatbot webhooks
      • Chatbot Passthrough Message Callback

Creating a Group

Feature Overview

This API is used by the app admin to create groups.

API Calling Description

Applicable group types

Group Type ID
RESTful API Support
Private
Yes. Same as work groups (Work) in the new version.
Public
Yes
ChatRoom
Yes. Same as meeting groups (Meeting) in the new version.
AVChatRoom
Yes. To use an audio-video group (AVChatroom), users (including the group owner) must use the SDK to request to join the group.
Community
Yes
These are the preset group types in Chat. For more information, see Group System.
Note
If the group type is specified as audio-video group (AVChatRoom):
When creating a group of this type, the group creator cannot add users to the group. If a group member is specified during the group creation, error 10007 will be returned. Users can only request to join this type of group. If a group owner is specified, the group owner must use the SDK API to join the group every time he or she uses the group.
If the group type is specified as a type other than an audio-video group (AVChatRoom):
If neither a group owner nor a group member list is specified when the request is sent, the number of groups that can be created is unrestricted.
If a group owner or group member list is specified when the request is sent, the specified group owner or group members are automatically added to the group.
If the total number of groups in the app exceeds 100,000, certain fees will be charged. For more information, see Pricing.
The number of groups that a user can join at the same time is limited. If the number is reached, joining or creating a group will fail. For more information, see Pricing.

Sample request URL

https://xxxxxx/v4/group_open_http_svc/create_group?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

Request parameters

The following table describes the modified parameters when this API is called. For other parameters, see RESTful API Overview.
Parameter
Description
xxxxxx
Domain name corresponding to 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
Silicon Valley: adminapiusa.im.qcloud.com
Jakarta: adminapiidn.im.qcloud.com
v4/group_open_http_svc/create_group
Request API
sdkappid
SDKAppID assigned by the Chat console when an app is created
identifier
App admin account. For more information, see the App Admin section in Login Authentication.
usersig
Signature generated by the app admin account. For details, see Generating UserSig.
random
A random 32-bit unsigned integer ranging from 0 to 4294967295.
contenttype
Request format, which should always be json.

Maximum call frequency

200 calls per second

Sample request

Basic format Create a group. The Owner_Account field is optional. If it is not specified, the group will have no group owner. If you want to specify a group owner, ensure that the UserId of the group owner has been imported.
{
"Owner_Account": "leckie", // UserId of the group owner (optional)
"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community
"Name": "TestGroup" // Group name (required)
}
Containing only basic group information Create a group and specify basic group information, such as the group introduction and group notice.
{
"Owner_Account": "leckie", // UserId of the group owner (optional)
"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community
"Name": "TestGroup", // Group name (required)
"Introduction": "This is group Introduction", // Group introduction (optional)
"Notification": "This is group Notification", // Group notice (optional)
"FaceUrl": "http://this.is.face.url", // Group profile photo URL (optional)
"MaxMemberCount": 500, // Maximum number of group members (optional)
"ApplyJoinOption": "FreeAccess" // Method for handling requests to join the group (optional)
}
Containing only group member information Create a group and specify to initialize the group member list, which is described in the request packet description table. When group members are initialized, only the Member_Account and Role fields can be set.
{
"Name": "TestGroup", // Group name (required)
"Type": "Public", // Group type: Private, Public, ChatRoom, or Community (AVChatRoom is not supported) (required)
"MemberList": [ // Initial group member list, which contains a maximum of 100 members (optional)
{
"Member_Account": "bob", // Member (required)
"Role": "Admin" // Role assigned to the member (optional). Currently, only the Admin option is available.
},
{
"Member_Account": "peter"
}
]
}
Custom group ID To simplify group IDs, Tencent Cloud allows apps to customize group IDs when creating groups through the RESTful API.
{
"Owner_Account": "leckie", // UserId of the group owner (optional)
"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community (required)
"GroupId": "MyFirstGroup", // User-defined group ID (optional)
"Name": "TestGroup" // Group name (required)
}
Containing only custom group information Create a group and specify group custom fields. The AppDefineData field is unavailable by default and needs to be enabled in the Chat console before use. For details, see the request packet field description table.
{
"Name": "TestGroup", // Group name (required)
"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community (required)
"AppDefinedData": [ // Group custom field (optional)
{
"Key": "GroupTestData1", // Key of the app custom field
"Value": "xxxxx" // Value of the custom field
},
{
"Key": " GroupTestData2",
"Value": "abc\u0000\u0001" // The custom field supports binary data.
}
]
}
Containing only custom group member information Create a group and specify group member custom fields. By default, AppMemberDefinedData is not available and needs to be enabled in the Chat console before use. For details, see the table for request packet fields.
{
"Owner_Account": "leckie", // UserId of the group owner (optional)
"Type": "Public", // Group type: Private, Public, ChatRoom, or Community (AVChatRoom is not supported) (required)
"Name": "TestGroup", // Group name (required)
"MemberList": [
{
"Member_Account":"bob",
"AppMemberDefinedData":[ // Group member custom field (optional)
{
"Key": "MemberDefined1", // Group member custom key
"Value": "MemberData1" // Value of the group member custom field
},
{
"Key": "MemberDefined2",
"Value": "MemberData2"
}
]
},
{
"Member_Account":"peter",
"AppMemberDefinedData":[
{
"Key": "MemberDefined1",
"Value": "MemberData1"
},
{
"Key": "MemberDefined2",
"Value": "MemberData2"
}
]
}
]
}
Containing only the topic-enabled parameter format Create a group and specify the type as a topic-enabled community.
{
"Type": "Community", // Group type (required)
"Name": "TestCommunityGroup", // Group name (required)
"SupportTopic": 1 // Whether the topic option is supported. Valid values: `1`: yes; `0`: no.
}
ALL IN ONE
{
"Owner_Account": "leckie", // UserId of the group owner (optional)
"Type": "Public", // Group type: Private, Public, ChatRoom, or Community (AVChatRoom is not supported) (required)
"GroupId":"MyFirstGroup", // User-defined group ID (optional)
"Name": "TestGroup", // Group name (required)
"Introduction": "This is group Introduction", // Group introduction (optional)
"Notification": "This is group Notification", // Group notice (optional)
"FaceUrl": "http://this.is.face.url", // Group profile photo URL (optional)
"MaxMemberCount": 500, // Maximum number of group members (optional)
"ApplyJoinOption": "FreeAccess", // Method for handling requests to join the group (optional)
"AppDefinedData": [ // Group custom field (optional)
{
"Key": "GroupTestData1", // Key of the app custom field
"Value": "xxxxx" // Value of the custom field
},
{
"Key": "GroupTestData2",
"Value": "abc\u0000\u0001" // The custom field supports binary data.
}
],
"MemberList": [ // Initial group member list, which contains a maximum of 100 members (optional)
{
"Member_Account": "bob", // Member (required)
"Role": "Admin", // Role assigned to the member. Currently, only the Admin option is available. (optional)
"AppMemberDefinedData":[ // Group member custom field (optional)
{
"Key":"MemberDefined1", // Group member custom key
"Value":"MemberData1" // Value of the group member custom field
},
{
"Key":"MemberDefined2",
"Value":"MemberData2"
}
]
},
{
"Member_Account": "peter",
"AppMemberDefinedData":[
{
"Key":"MemberDefined1",
"Value":"MemberData1"
},
{
"Key":"MemberDefined2",
"Value":"MemberData2"
}
]
}
]
}


Request fields

Field
Type
Required
Description
Owner_Account
String
Optional
Group owner ID, which must be an imported account. The value will be automatically added to group members. If this field is not specified, the group will have no group owner, and group members need to call the group joining API when using an audio-video group (AVChatroom) group.
Type
String
Required
Group type, including Public, Work (Private), Meeting, AVChatRoom, and Community.
GroupId
String
Optional
To simplify group IDs and make them easier to remember and share, we allow apps to customize group IDs when creating groups through the RESTful API.
Name
String
Required
Group name, whose maximum length is 30 bytes. This field is UTF-8-encoded, and one Chinese character occupies 3 bytes.
Introduction
String
Optional
Group introduction, whose maximum length is 240 bytes. This field is UTF-8-encoded, and one Chinese character occupies 3 bytes.
Notification
String
Optional
Group notice, whose maximum length is 300 bytes. This field is UTF-8-encoded, and one Chinese character occupies 3 bytes.
FaceUrl
String
Optional
URL of the group profile photo, whose maximum length is 100 bytes.
MaxMemberCount
Integer
Optional
Maximum number of group members. The default value is the upper limit of the paid package. For example, it is 20 for a Developer edition. If you upgrade your package, you need to modify this field according to the basic information of the modified group.
ApplyJoinOption
String
Optional
Method for handling requests to join the group, which can be FreeAccess, NeedPermission, or DisableApply. The default method is NeedPermission.
This field is valid only for groups that can be joined by users. Community groups currently do not support this field.
AppDefinedData
Array
Optional
Group-level custom field. This field is unavailable by default and needs to be enabled in the Chat console. For details, see Custom Fields.
MemberList
Array
Optional
Initial group member list, which contains a maximum of 100 members. For details on group member information fields, see Group member profile.
AppMemberDefinedData
Array
Optional
Group member custom fields. This field is unavailable by default and needs to be enabled in the Chat console. For details, see Custom Fields.
SupportTopic
Integer
No
Whether the topic option is supported. This field is valid only for communities.

Sample response

Basic form, containing only basic group information, containing only group member information, or containing only custom information
{
"ActionStatus": "OK",
"ErrorInfo": "",
"ErrorCode": 0,
"GroupId": "@TGS#2J4SZEAEL"
}
Containing only the topic-enabled parameter format
{
"ActionStatus": "OK",
"ErrorInfo": "",
"ErrorCode": 0,
"GroupId": "@TGS#_@TGS#cRDH3HIM62CP",
"HugeGroupFlag": 0,
"Type": "Community"
}
Custom group ID and ALL IN ONE
{
"ActionStatus": "OK",
"ErrorInfo": "",
"ErrorCode": 0,
"GroupId": "MyFirstGroup"
}

Response fields

Field
Type
Description
ActionStatus
String
Request result. OK: Successful; FAIL: Failed
ErrorCode
Integer
Error code. 0: Successful; other values: Failed
ErrorInfo
String
Error information
GroupId
String
Group ID after successful creation, which is assigned by the Chat backend.

Error Codes

The returned HTTP status code for this API is always 200 unless a network error (such as error 502) occurs. The specific error code and details can be found in the response fields ErrorCode and ErrorInfo respectively. For public error codes (60000 to 79999), see Error Codes. The following table describes the error codes specific to this API:
Error Code
Description
10002
Internal server error. Try again.
10003
Invalid request command word.
10004
Invalid parameter. Check the error description and fix the issue.
10005
The number of members imported in the request packet exceeds 100. Reduce the number of members imported in the MemberList parameter.
10006
The operation exceeds the frequency limit. Please reduce the call frequency. This error is usually caused by too much net group increase in a single day or too frequent calls to obtain all groups in the app.
10007
Insufficient operation permission. Check the request parameters based on the error information. For example, the specified group type does not allow adding members but MemberList was specified in the request.
10008
The request is invalid, probably because verification of the signing information in the request failed. Please try again or submit a ticket.
10016
The app backend rejected this operation through a webhook. Check the returned value of your wehook "Before a group is created".
10021
The group ID has already been used by another user. Select another group ID.
10025
You have already used this group ID. Disband the existing group first or select another group ID.
10036
The number of audio-video groups (AVChatRoom) created exceeds the limit. Delete some of the groups or purchase an upgrade by referring to Pricing.
10037
The request specifies Owner_Account, but the number of groups that the group owner has created or joined exceeds the limit. The group owner needs to leave some groups first or refer to Pricing to purchase an upgrade.
10038
The number of members imported in the request packet exceeds the limit. Reduce the number of members imported in the MemberList parameter or purchase an upgrade by referring to Pricing.
10058
You are now using the Developer edition, and the free quota of 100 groups is exceeded. To create more groups, you need to purchase a package.

API Debugging Tool

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

References

Possible Callbacks