rolesV2()

API Stability Short-Term

The rolesV2() GraphQL query will retrieve a list of the roles assigned to the user through a group.

For more information on roles in LogScale, see the Manage Roles documentation page. You may also want to look at the Manage Users and Permissions page for related information.

Syntax

Below is the syntax for the rolesV2() query field:

graphql
rolesV2(
      search: string, 
      typeFilter: [PermissionType], 
      limit: integer, 
      skip: integer, 
      searchInGroups: boolean
   ): RolesResultSetType!

For limit the default value is 50. For skip the default is 0 Below is an example of how it might be used:

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

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 {
    rolesV2()
       {totalResults,
        results {id, displayName, 
                 organizationPermissions }
    }
}"
}
);


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": {
    "rolesV2": {
    "totalResults": "6",
    "results": [
      {
        "id": "pFLOxe7C8zkNbWOSP8VartJ0I6Kz0eK2",
        "displayName": "Member",
        "organizationPermissions": []
      },
      {
        "id": "8TKAG5afPxvPcqGJ8De8ccMeJSFiBckE",
        "displayName": "OrgManager",
        "organizationPermissions": [
          "ChangeIPFilters",
          "DeleteAllViews",
          "DeleteAllRepositories",
          "ChangeSecurityPolicies",
          "ChangeOrganizationPermissions",
          "ViewAllInternalNotifications",
          "ChangeSessions",
          "ManageViewConnections",
          "IngestAcrossAllReposWithinOrganization",
          "ChangeFieldAliases",
          "CreateRepository",
          "ManageUsers",
          "ViewUsage",
          "ChangeTriggersToRunAsOtherUsers",
          "ViewFleetManagement",
          "ChangeAllViewOrRepositoryPermissions",
          "ChangeFleetManagement"
        ]
      }
    ...  
    ] }
  }
}

Given Datatypes

PermissionType is an enumerated list of values. They're described below:

Table: PermissionType

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: Oct 3, 2025
AssetPermission   Long-TermThe type of permission is related to assets.
OrganizationManagementPermission   Long-TermThe permission is for the management of an organization.
OrganizationPermission   Long-TermThe permission is based on an organization.
SystemPermission   Long-TermThe permission is for the system.
ViewPermission   Long-TermThe permission is for a view.

Returned Datatypes

The returned datatype RolesResultSetType has several parameters. Below is a list of them along with a description of each:

Table: RolesResultSetType

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: Oct 3, 2024
results[Role]yes Long-TermThe paginated result set. See Role.
totalResultsintegeryes Long-TermThe total number of matching results.