After you've created a group, you'll need to add users to it to be useful. This can be done with the addUsersToGroup() GraphQL mutation.

To remove users from a group, you would use the removeUsersFromGroup() mutation. You use the group() and groupsPage() queries to get information on groups.

Hide Query Example

Show Users in Group Query

For more information on groups, see the Manage Groups documentation page. To add users to a group using the LogScale user interface, instead of the GraphQL API, read the section Add Users to Groups.

API Stability Long-Term
Security Requirement & Control ManageUsers API permission

Syntax

graphql
addUsersToGroup(
      input: AddUsersToGroupInput!
   ): AddUsersToGroupMutation!

When adding a user to a group, you'll need to enter the unique identifier of the group, and the user names in a comma-separated list. Incidentally, you have to create user accounts before you can add them to a group. For an example of how to get the group identifier and a list of user names, click on the Show Query link above. See the Given Datatype section for details on the input parameters.

For the results, you can get plenty of information on the group and the users. See the Returned Datatype section for your choices.

Example

Raw
graphql
mutation {
  addUsersToGroup(input: 
         { groupId: "abc123",
           users: ["tom", "wilbur"] } )
    { group {displayName, userCount} }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  addUsersToGroup(input: 
         { groupId: \"abc123\",
           users: [\"tom\", \"wilbur\"] } )
    { group {displayName, userCount} }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  addUsersToGroup(input: 
         { groupId: \"abc123\",
           users: [\"tom\", \"wilbur\"] } )
    { group {displayName, userCount} }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  addUsersToGroup(input:  ^
         { groupId: \"abc123\", ^
           users: [\"tom\", \"wilbur\"] } ) ^
    { group {displayName, userCount} } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  addUsersToGroup(input: 
         { groupId: \"abc123\",
           users: [\"tom\", \"wilbur\"] } )
    { group {displayName, userCount} }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  addUsersToGroup(input: 
         { groupId: \"abc123\",
           users: [\"tom\", \"wilbur\"] } )
    { group {displayName, userCount} }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  addUsersToGroup(input: 
         { groupId: \"abc123\",
           users: [\"tom\", \"wilbur\"] } )
    { group {displayName, userCount} }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  addUsersToGroup(input: 
         { groupId: \"abc123\",
           users: [\"tom\", \"wilbur\"] } )
    { group {displayName, userCount} }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "addUsersToGroup": {
      "group": {
        "displayName": "Maintainers",
        "userCount": 6
      }
    }
  }
}

Given Datatype

For this datatype, you would give a list of users to add to a group — and the group's unique identifier. Click on Show Query near the top of this page for how to get those details.

Table: AddUsersToGroupInput

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Aug 18, 2025
groupIdstring  Long-TermThe unique identifier for the group.
users[string]yes Long-TermA list of unique identifier of users to add to group.

Returned Datatype

With the returned datatype, through sub-parameters, you can get the total number of users and groups, and information on users and on groups: for users, you can get their names, email addresses, etc.; for groups, you can get a list of roles, permissions, and counts. The table below shows one parameter. The second table contains the sub-parameters.

Table: AddUsersToGroupMutation

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Sep 23, 2024
groupGroupyes Long-TermThe group for which to add users. See Group.

Table: Group

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Sep 11, 2025
allowedAssetActionsBySource(assetId: string, assetType: AssetPermissionsAssetType, searchDomainId: string): GroupAssetActionsBySourcemultipleyes PreviewGet allowed asset actions for the group on a specific asset and explain how it has gotten this access. See AssetPermissionsAssetType GroupAssetActionsBySource.
defaultQueryPrefixstring  Long-TermThe default prefix for queries.
defaultRoleRole  Long-TermThe default role associated with the group. See Role.
defaultSearchDomainCountintegeryes Long-TermThe default search domain count.
displayNamestringyes Long-TermThe display name of the group.
idstringyes Long-TermThe identifier of the group.
lookupNamestring  Long-TermThe look-up name for the group.
organizationRoles[GroupOrganizationRole]yes Long-TermThe roles of the organization associated with the group. See GroupOrganizationRole.
permissionTypePermissionType  Long-TermIndicates which level of permissions the group contains. See PermissionType .
queryPrefixes(onlyIncludeRestrictiveQueryPrefixes: boolean, onlyForRoleWithId: string): [QueryPrefixes]multiple  Long-TermThe query prefixes for the group. See QueryPrefixes.
roles[SearchDomainRole]yes Long-TermThe roles for the group See SearchDomainRole.
searchAssetPermissions(searchFilter: string, skip: integer, limit: integer, orderBy: OrderBy, sortBy: SortBy, assetTypes: [AssetPermissionsAssetType], searchDomainIds: [string], permissions: [AssetAction], includeUnassignedAssets: boolean): AssetPermissionSearchResultSetmultipleyes Short-TermSearch for asset permissions for the group. This is a preview and subject to change. See AssetPermissionsAssetType AssetAction, and AssetPermissionSearchResultSet.
searchDomainCountintegeryes Long-TermThe number of search domains for the group.
searchDomainRoles(searchDomainId: string): [SearchDomainRole]multipleyes Long-TermThe search domain roles assigned to the group. See SearchDomainRole.
searchDomainRolesByName(searchDomainName: string): SearchDomainRolemultipleyes Deprecated

The search domain roles assigned to the group, by name. See SearchDomainRole. When multiple roles per view is enabled, this field will return only the first of possibly multiple roles matching the name for the view.

Use roles, searchDomainRoles, or searchDomainRolesBySearchDomainName fields instead. This field will be removed at the earliest in version 1.195.

searchDomainRolesBySearchDomainName(searchDomainName: string): [SearchDomainRole]multipleyes Long-TermThe domain roles by search domain name. See SearchDomainRole.
searchUsers(searchFilter: string, skip: integer, limit: integer, sortBy: OrderByUserField, orderBy: OrderBy): UserResultSetTypemultiple  Long-TermUsed to search the list of users in the group. See OrderByUserField , OrderBy , UserResultSetType.
systemRoles[GroupSystemRole]yes Long-TermThe system roles of the group. See GroupSystemRole.
userCountintegeryes Long-TermThe number of users that are part of the group.
users[User]yes Long-TermThe list of users in the group. See User.