Summary

The rolesInOrgForChangingUserAccess() GraphQL query field returns defined roles in an organization for a user.

API Stability Long-Term

Syntax

graphql
rolesInOrgForChangingUserAccess(
      searchDomainId: String!
   ): [Role!]!

Provide searchDomainId (required) — the unique identifier for the search domain. If the ID is not known, use the searchDomains() query to list available search domains.

Returns a non-nullable list of Role objects. See the Returned Values section for available fields.

Example

Raw
graphql
query {
   rolesInOrgForChangingUserAccess(
      searchDomainId: "abc123"
   ) 
   { id, displayName, usersCount }
}
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" : "query {
   rolesInOrgForChangingUserAccess(
      searchDomainId: \"abc123\"
   ) 
   { id, displayName, usersCount }
}"
}
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" : "query {
   rolesInOrgForChangingUserAccess(
      searchDomainId: \"abc123\"
   ) 
   { id, displayName, usersCount }
}"
}
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" : "query { ^
   rolesInOrgForChangingUserAccess( ^
      searchDomainId: \"abc123\" ^
   )  ^
   { id, displayName, usersCount } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
   rolesInOrgForChangingUserAccess(
      searchDomainId: \"abc123\"
   ) 
   { id, displayName, usersCount }
}"
}'
    "$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 = "query {
   rolesInOrgForChangingUserAccess(
      searchDomainId: \"abc123\"
   ) 
   { id, displayName, usersCount }
}";
$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" : "query {
   rolesInOrgForChangingUserAccess(
      searchDomainId: \"abc123\"
   ) 
   { id, displayName, usersCount }
}"
}'''

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" : "query {
   rolesInOrgForChangingUserAccess(
      searchDomainId: \"abc123\"
   ) 
   { id, displayName, usersCount }
}"
}
);


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": {
    "rolesInOrgForChangingUserAccess": [
      {
        "id": "def456",
        "displayName": "Admin",
        "usersCount": 1
      },
      {
        "id": "hij789",
        "displayName": "Member",
        "usersCount": 14
      }
    ]
  }
}

Returned Values

Returns a non-nullable list of Role objects. The table below lists all fields:

Table: Role Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for the results. 
Table last updated: Oct 14, 2026 
descriptionString  Long-Term A description of the role.
displayNameStringyes Long-Term The display name of the role.
groupsGroupyes Long-Term The groups related to the role. See Group.
groupsCountIntyes Long-Term The number of groups related to the role.
idStringyes Long-Term The unique identifier for the role.
limitInt,    The amount of results to return.
organizationManagementPermissionsOrganizationManagementPermissionyes Long-Term The organization management permissions given to the role. See OrganizationManagementPermission.
organizationPermissionsOrganizationPermissionyes Long-Term The organization permissions given to the role. See OrganizationPermission.
readonlyDefaultRoleReadonlyDefaultRole  Short-Term The read-only default role. This parameter is a preview and subject to change. See ReadonlyDefaultRole.
skipInt):GroupResultSetTypeyes Long-Term The number of results to skip or the offset to use. For instance if implementing pagination, set skip = limit * (page - 1)
systemPermissionsSystemPermissionyes Long-Term The system permissions given to the role. See SystemPermission.
usersUseryes Long-Term A list of users assigned the role. See User.
usersCountIntyes Long-Term The number of users assigned the role.
viewPermissionsPermissionyes Long-Term The view permissions given to the role. See Permission.