Skip to main content


fetchGroupRoles function returns an array with details about roles associated with the specified group.


  • groupId (string): ID of the group for which you want to fetch roles. This parameter is required.

  • owner (Address): address of the owner of the group. This parameter is required.

Code example

import { Sdk } from "@peaq-network/sdk";

* Fetches roles associated with a specific group from the RBAC system.
* @param {string} groupId - The ID of the group for which to fetch roles (required).
* @param {Address} owner - The address of the owner of the group (required).
* @returns {Promise<Array<Object>>} - A promise that resolves to an array of objects containing fetched role details.
const fetchGroupRoles = async (groupId, owner) => {
const sdkInstance = await Sdk.createInstance({
baseUrl: "wss://",

try {
const roles = await sdkInstance.rbac.fetchGroupRoles({

return roles;
} finally {
await sdkInstance.disconnect();

// Example usage
const groupId = "02709409-kd01-4444-8222-b5zz8512";
const ownerAddress = "5GsA2xjSBY6DhpTGKKdJ4BjUYpbBaP5wxZnvBoHSytURn6N2";
fetchGroupRoles(groupId, ownerAddress)
.then((roles) => {
console.log("Fetched Group Roles:", roles);
.catch((error) => {
console.error("Error fetching group roles:", error);

Response object

"role": "78709009-cf06-4224-8632-b5ee8512",
"group": "02709409-kd01-4444-8222-b5zz8512"