Skip to main content


createPermission function allows to create new permissions within the RBAC (Role-Based Access Control) system. This function returns JSON object with permission ID.


  • permissionName (required): name of the permission to be created.

  • permissionId (optional): ID of the permission to be created.

  • address (optional): address associated with the permission. This parameter is not required.

  • seed (optional): mnemonic seed. This parameter is not required.

Code example

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

* Create a new permission within the RBAC system.
* @param {string} permissionName - The name of the permission to be created (required).
* @param {string} [permissionId] - The ID of the permission (not required).
* @param {Address} [address] - The address associated with the permission (not required).
* @param {string} [seed] - The mnemonic seed (not required).
* @returns {string} The ID of the newly created permission.
const createPermission = async (permissionName, seed) => {
const sdkInstance = await Sdk.createInstance({
baseUrl: "wss://",

try {
await sdkInstance.connect();
const permissionId = await sdkInstance.rbac.createPermission({
permissionName: permissionName,

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

// Example usage
const name = 'myPermission';
// Before creating your new permission, you should have some balance in your generated seed.
const seed = "your-seed-phrase";

createPermission(name, seed)
.then((permissionId) => {
console.log(`Created permission Id: ${permissionId}`);
.catch((error) => {
console.error(`Error creating new permission: ${error}`);

Response object

permissionId: "18709409-bc06-4444-2222-b4zz0000"