Create Group

Creates a new group/channel, optionally including specified users. The group creator is always included.

HTTP MethodURLRequires Auth

POST

/api/v1/groups.create

Body Parameters

KeyExample ValueDescription

name*

testing

The name of the new private group.

members

["rocket.cat"]

The users to be added to the group when it is created.

readOnly

true

Set if the group is read only or not. The default value is false.

excludeSelf

true

If set to true the user calling the endpoint is not automatically added as a member of the group. The default value is false.

customFields

{ "type": "default" }

If you have defined custom fields for your workspace, you can provide them in this object parameter.

extraData

"extraData": { "broadcast": true, "encrypted": false,

"teamId": "658441562dd9f928ad9951aa" }

Enter the following details for the object:

  • broadcast: Whether the group should be a broadcast group.

  • encrypted: Whether the group should be encrypted.

  • teamId: Enter the team ID for which you want to create a group.

For more information, see Channels.

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type: application/json" \
     http://localhost:3000/api/v1/groups.create \
     -d '{ 
          "name": "testing" }'

Example Response

{
  "group": {
    "_id": "NtR6RQ7NvzA9ejecX",
    "name": "testing",
    "t": "p",
    "msgs": 0,
    "u": {
      "_id": "aobEdbYhXfu5hkeqG",
      "username": "tester"
    },
    "ts": "2016-12-09T16:53:06.761Z",
    "ro": false,
    "sysMes": true,
    "_updatedAt": "2016-12-09T16:53:06.761Z"
  },
  "success": true
}

Change Log

VersionDescription

6.4.1

Added excludeSelf param

0.35.0

Added

Last updated

Rocket.Chat versions receive support for six months after release.