API Stability Long-Term

The addUsersToGroup() GraphQL mutation is used to add users to an existing group.

For more information on user authorization, see the Manage users & permissions documentation page. In particular, read the section on groups, Manage Groups.

Syntax

Below is the syntax for the addUsersToGroup() mutation field:

graphql
addUsersToGroup(
      input: AddUsersToGroupInput!
   ): AddUsersToGroupMutation!

Below is an example of how this mutation field might be used:

Show:
graphql
mutation {
  addUsersToGroup(input: 
         { groupId: "0dVscp645a6lCbe1WuJxjPbRRF5uBMD5",
           users: ["tom", "wilbur"] } )
    { group {displayName, userCount} }
}
Example Responses
Show:
json
{
  "data": {
    "addUsersToGroup": {
      "group": {
        "displayName": "Maintainers",
        "userCount": 6
      }
    }
  }
}

Given Datatypes

For AddUsersToGroupInput, there are a couple of parameters that may be given. Below is a list of them along with their datatype and a description of each:

Table: AddUsersToGroupInput

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 17, 2024
groupIdstring  Long-TermThe unique identifier for the group.
users[string]yes Long-TermA list of user IDs to add to group.

Returned Datatypes

AddUsersToGroupMutation has one parameter, with several sub-parameters:

Table: AddUsersToGroupMutation

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 23, 2024
groupGroupyes Long-TermThe group for which to add users. See Group.