Skip to main content


assignUserToGroup function assigns a user to a group within the RBAC (Role-Based Access Control) system. This function returns a JSON object with user and group IDs.


  • userId (string, required): ID of the user to be assigned.

  • groupId (string, required): ID of the group to which the user will be assigned.

  • address (Address, not-required): address associated with the operation.

  • seed (string, not-required): mnemonic seed.

Code example

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

* Assign a user to a group within the RBAC system.
* @param {string} userId - The ID of the user to be assigned (required).
* @param {string} groupId - The ID of the group (required).
* @param {Address} [address] - The address associated with the operation (not required).
* @param {string} [seed] - The mnemonic seed (not required).
* @returns {Promise<Object>} A promise that resolves to an object containing a message.
const assignUserToGroup = async (userId, groupId, seed) => {
const sdkInstance = await Sdk.createInstance({
baseUrl: "wss://",

try {
const result = await sdkInstance.rbac.assignUserToGroup({

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

// Example usage
const userId = "44759999-az06-2112-7130-b5kk4321";
const groupId = "02709409-kd01-4444-8222-b5zz8512";
const seed = "your-seed-phrase";
assignUserToGroup(userId, groupId)
.then((result) => {
.catch((error) => {
console.error("Error assigning user to group:", error);

Response object

message: "Successfully unassign user: 44759999-az06-2112-7130-b5kk4321 from group: 02709409-kd01-4444-8222-b5zz8512"