> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peaq.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Permission

## create\_permission(permission\_name, permission\_id)

Used to create a new permission within the RBAC (Role-Based Access Control) system.

| Parameter            | Type            | EVM      | Substrate | Description                                                                          |
| -------------------- | --------------- | -------- | --------- | ------------------------------------------------------------------------------------ |
| **permission\_name** | `str`           | Required | Required  | Name of the permission to be created.                                                |
| **permission\_id**   | `Optional[str]` | Optional | Optional  | ID of the permission (32 characters). If not supplied one will be generated for you. |

### Create Permission Code Examples

<CodeGroup>
  ```python EVM Unsigned Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  permission_name = "peaq-permission-1"

  response = sdk.rbac.create_permission(permission_name=permission_name)
  ```

  ```python EVM Unsigned Tx Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC create permission call for the permission name of peaq-permission-1 and permission id of 307a081a-45e5-4ca3-b2b5-566ceb31. You must sign and send externally.",
    "tx": {
      "to": "0x0000000000000000000000000000000000000802",
      "data": "0x67a2e51533303761303831612d343565352d..."
    }
  }
  ```

  ```python EVM Write Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )

  permission_name = "peaq-permission-1"

  response = sdk.rbac.create_permission(permission_name=permission_name)
  ```

  ```python EVM Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully added the RBAC permission under the permission name of peaq-permission-1 with the permission id of 290506fd-b316-4a10-bd33-e8e2e047.",
    "receipt": {
      "transactionHash": "0xf79c1d4e036d3fa85671ec280760991a028f9bc36dc45a4adc1be6dab161bb63",
      "transactionIndex": 0,
      "blockHash": "0x752bf6f56b1d1a739025aa778818fd2e5fe8235b5dfd332aac057b18e602f3a8",
      "from": "0x9Eeab1aCcb1A701aEfAB00F3b8a275a39646641C",
      "to": "0x0000000000000000000000000000000000000802",
      "blockNumber": 5847866,
      "cumulativeGasUsed": 45011,
      "gasUsed": 45011,
      "contractAddress": null,
      "logs": [
        {
          "address": "0x0000000000000000000000000000000000000802",
          "topics": [
            "0xc6eed8c2ac8c5641c34df1a054ceb451fa58fcb301be09f2f304c01c24c7cde9"
          ],
          "data": "0x0000000000000000000000009eeab1accb1a701aefab00f3b8a275a39646641c32393035..."
          "blockHash": "0x752bf6f56b1d1a739025aa778818fd2e5fe8235b5dfd332aac057b18e602f3a8",
          "blockNumber": 5847866,
          "transactionHash": "0xf79c1d4e036d3fa85671ec280760991a028f9bc36dc45a4adc1be6dab161bb63",
          "transactionIndex": 0,
          "logIndex": 0,
          "transactionLogIndex": "0x0",
          "removed": false
        }
      ],
      "logsBloom": "0x000000000000000000000000000000000000000...",
      "status": 1,
      "effectiveGasPrice": 102000000000,
      "type": 2
    }
  }
  ```

  ```python Substrate Unsigned Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  permission_name = "peaq-permission-1"

  response = sdk.rbac.create_permission(permission_name=permission_name)
  ```

  ```python Substrate Unsigned Call Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC create permission call for the permission name of peaq-permission-1 and permission id of 392a18cb-9de1-4f41-82fd-7ed1b1e8. You must sign and send externally.",
    "call": {
      "call_module": "PeaqRbac",
      "call_function": "add_permission",
      "call_args": {
        "permission_id": "392a18cb-9de1-4f41-82fd-7ed1b1e8",
        "name": "peaq-permission-1"
      }
    }
  }
  ```

  ```python Substrate Write Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )

  permission_name = "peaq-permission-1"

  response = sdk.rbac.create_permission(permission_name=permission_name)
  ```

  ```python Substrate Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully added the RBAC permission under the permission name of peaq-permission-1 with the permission id of 6e100511-7cc1-4365-b18e-d7b0f3ce.",
    "receipt": {
      "extrinsic_hash": "0x0755042c17a5cc1cebae3f1061913ac610723392600fe5c2f861670287eeea4d",
      "block_hash": "0x3cef644279f0835d209b83bb715c8d7d091cdfeffa5fb07ef74839909701c940",
      "finalized": false,
      "extrinsic_idx": 2,
      "call": {
        "call_module": "PeaqRbac",
        "call_function": "add_permission",
        "call_args": {
          "permission_id": "6e100511-7cc1-4365-b18e-d7b0f3ce",
          "name": "peaq-permission-1"
        }
      },
      "events": [...],
      "total_fee_amount": 2510946098108087
    }
  }
  ```
</CodeGroup>

## fetch\_permission(owner, permission\_id)

Used to fetch a permission in the RBAC system by its permission ID.

| Parameter          | Type  | EVM      | Substrate | Description                                       |
| ------------------ | ----- | -------- | --------- | ------------------------------------------------- |
| **owner**          | `str` | Required | Required  | Address representing the owner of the permission. |
| **permission\_id** | `str` | Required | Required  | ID of the permission to be fetched.               |

### Fetch Permission Code Examples

<CodeGroup>
  ```python EVM Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_ADDRESS = os.getenv("EVM_ADDRESS")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  permission_id = "290506fd-b316-4a10-bd33-e8e2e047"

  response = sdk.rbac.fetch_permission(
      owner=EVM_ADDRESS,
      permission_id=permission_id
  )
  ```

  ```python EVM Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "id": "290506fd-b316-4a10-bd33-e8e2e047",
    "name": "peaq-permission-1",
    "enabled": true
  }
  ```

  ```python Substrate Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_ADDRESS = os.getenv("SUBSTRATE_ADDRESS")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  permission_id = "6e100511-7cc1-4365-b18e-d7b0f3ce"

  response = sdk.rbac.fetch_permission(
      owner=SUBSTRATE_ADDRESS,
      permission_id=permission_id
  )
  ```

  ```python Substrate Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "id": "6e100511-7cc1-4365-b18e-d7b0f3ce",
    "name": "peaq-permission-1",
    "enabled": true
  }
  ```
</CodeGroup>

## fetch\_permissions(owner)

Used to fetch all permissions associated with the passed owner address.

| Parameter | Type  | EVM      | Substrate | Description                                                       |
| --------- | ----- | -------- | --------- | ----------------------------------------------------------------- |
| **owner** | `str` | Required | Required  | Address that represents the owner of all the fetched permissions. |

### Fetch Permissions Code Examples

<CodeGroup>
  ```python EVM Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_ADDRESS = os.getenv("EVM_ADDRESS")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  response = sdk.rbac.fetch_permissions(owner=EVM_ADDRESS)
  ```

  ```python EVM Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "id": "88dec9d0-354e-4ab6-9856-7a7eb45c",
      "name": "Permission-name-123",
      "enabled": true
    },
    {
      "id": "ae7eda2f-a0fd-46db-bac3-1e19ba87",
      "name": "permission-name-123",
      "enabled": true
    }
  ]
  ```

  ```python Substrate Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_ADDRESS = os.getenv("SUBSTRATE_ADDRESS")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  response = sdk.rbac.fetch_permissions(owner=SUBSTRATE_ADDRESS)
  ```

  ```python Substrate Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "id": "77395752-8588-47c5-8bd5-0d2bf273",
      "name": "peaq-permission-new",
      "enabled": false
    },
    {
      "id": "fc49ee05-f0ad-47ce-b336-62efdfec",
      "name": "peaq-permission-2",
      "enabled": true
    }
  ]
  ```
</CodeGroup>

## update\_permission(permission\_id, permission\_name)

Updates the name of an existing permission.

| Parameter            | Type  | EVM      | Substrate | Description                                     |
| -------------------- | ----- | -------- | --------- | ----------------------------------------------- |
| **permission\_id**   | `str` | Required | Required  | ID of the permission to update (32 characters). |
| **permission\_name** | `str` | Required | Required  | New name for the permission.                    |

### Update Permission Code Examples

<CodeGroup>
  ```python EVM Unsigned Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  permission_id = "307a081a-45e5-4ca3-b2b5-566ceb31"
  permission_name = "updated-permission-1"

  response = sdk.rbac.update_permission(
      permission_id=permission_id,
      permission_name=permission_name
  )
  ```

  ```python EVM Unsigned Tx Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC update permission call for permission 307a081a-45e5-4ca3-b2b5-566ceb31 with name updated-permission-1. You must sign and send externally.",
    "tx": {
      "to": "0x0000000000000000000000000000000000000802",
      "data": "0xb0c5b5ad33303761303831612d34356535..."
    }
  }
  ```

  ```python EVM Write Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )

  permission_id = "290506fd-b316-4a10-bd33-e8e2e047"
  permission_name = "updated-permission-1"

  response = sdk.rbac.update_permission(
      permission_id=permission_id,
      permission_name=permission_name
  )
  ```

  ```python EVM Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully updated permission 290506fd-b316-4a10-bd33-e8e2e047 with name updated-permission-1.",
    "receipt": {
      "transactionHash": "0x422c4891625ecfb872bb3dd5acaf5acd9af9e3ed6d769300c32e3e81f7f63d66",
      "transactionIndex": 0,
      "blockHash": "0x91b560fbe6d99757bb698dcb189419d2ab14a416600f70c2337052bb4f54b536",
      "from": "0x9Eeab1aCcb1A701aEfAB00F3b8a275a39646641C",
      "to": "0x0000000000000000000000000000000000000802",
      "blockNumber": 5847998,
      "cumulativeGasUsed": 34459,
      "gasUsed": 34459,
      "contractAddress": null,
      "logs": [
        {
          "address": "0x0000000000000000000000000000000000000802",
          "topics": [
            "0xf61e9daf2fc29e541fe654014f4239a5f1bd8f8e5bfbadf9211407e876a7a591"
          ],
          "data": "0x0000000000000000000000009eeab1accb1a701aefab00f3b8a275a39646641...",
          "blockHash": "0x91b560fbe6d99757bb698dcb189419d2ab14a416600f70c2337052bb4f54b536",
          "blockNumber": 5847998,
          "transactionHash": "0x422c4891625ecfb872bb3dd5acaf5acd9af9e3ed6d769300c32e3e81f7f63d66",
          "transactionIndex": 0,
          "logIndex": 0,
          "transactionLogIndex": "0x0",
          "removed": false
        }
      ],
      "logsBloom": "0x000000000000000000000000000000000000000...",
      "status": 1,
      "effectiveGasPrice": 102000000000,
      "type": 2
    }
  }
  ```

  ```python Substrate Unsigned Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  permission_id = "392a18cb-9de1-4f41-82fd-7ed1b1e8"
  permission_name = "updated-permission-1"

  response = sdk.rbac.update_permission(
      permission_id=permission_id,
      permission_name=permission_name
  )
  ```

  ```python Substrate Unsigned Call Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC update permission call for permission 392a18cb-9de1-4f41-82fd-7ed1b1e8 with name updated-permission-1. You must sign and send externally.",
    "call": {
      "call_module": "PeaqRbac",
      "call_function": "update_permission",
      "call_args": {
        "permission_id": "392a18cb-9de1-4f41-82fd-7ed1b1e8",
        "name": "updated-permission-1"
      }
    }
  }
  ```

  ```python Substrate Write Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )

  permission_id = "6e100511-7cc1-4365-b18e-d7b0f3ce"
  permission_name = "updated-permission-1"

  response = sdk.rbac.update_permission(
      permission_id=permission_id,
      permission_name=permission_name
  )
  ```

  ```python Substrate Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully updated permission 6e100511-7cc1-4365-b18e-d7b0f3ce with name updated-permission-1.",
    "receipt": {
      "extrinsic_hash": "0x394bc58eb8dba5b8564dbe3c821b0506b06241eea701e2bf8cf746a612014670",
      "block_hash": "0x39c9e892ec55ac8f02fa0442c3023deaddee4fe8985df03425e556acce641bcf",
      "block_number": null,
      "finalized": false,
      "extrinsic_index": 2,
      "call": {
        "call_index": "0x670b",
        "call_function": "update_permission",
        "call_module": "PeaqRbac",
        "call_args": [
          {
            "name": "permission_id",
            "type": "EntityId",
            "value": "0x36653130303531312d376363312d343336352d623138652d6437623066336365"
          },
          {
            "name": "name",
            "type": "BoundedVec<u8, BoundedDataLen>",
            "value": "updated-permission-1"
          }
        ],
        "call_hash": "0xb8275befb4fc4106a9afa27fde41cdbb8d73889e13e6adea2df45721724c7bf3"
      },
      "events": [...],
      "is_success": true,
      "error_message": null,
      "weight": {
        "ref_time": 405299000,
        "proof_size": 3890
      },
      "total_fee_amount": 2139575238719276
    }
  }

  ```
</CodeGroup>

## disable\_permission(permission\_id)

Disables a permission within the RBAC system. A disabled permission cannot be used for new role assignments.

| Parameter          | Type  | EVM      | Substrate | Description                                      |
| ------------------ | ----- | -------- | --------- | ------------------------------------------------ |
| **permission\_id** | `str` | Required | Required  | ID of the permission to disable (32 characters). |

### Disable Permission Code Examples

<CodeGroup>
  ```python EVM Unsigned Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  permission_id = "307a081a-45e5-4ca3-b2b5-566ceb31"

  response = sdk.rbac.disable_permission(permission_id=permission_id)
  ```

  ```python EVM Unsigned Tx Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC disable permission call for permission 307a081a-45e5-4ca3-b2b5-566ceb31. You must sign and send externally.",
    "tx": {
      "to": "0x0000000000000000000000000000000000000802",
      "data": "0x727e011e33303761303831612d343565352d..."
    }
  }
  ```

  ```python EVM Write Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )

  permission_id = "290506fd-b316-4a10-bd33-e8e2e047"

  response = sdk.rbac.disable_permission(permission_id=permission_id)
  ```

  ```python EVM Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully disabled permission 290506fd-b316-4a10-bd33-e8e2e047.",
    "receipt": {
      "transactionHash": "0x69a7a8ee26c1ff14a848f4eeb11b7754347f729ebe61fff223b42eb773e7064d",
      "transactionIndex": 0,
      "blockHash": "0xae3e35fb404bac3f87ceb5a8de6a1b7f557c25f7a4cd7d9cc26eb3891567641a",
      "from": "0x9Eeab1aCcb1A701aEfAB00F3b8a275a39646641C",
      "to": "0x0000000000000000000000000000000000000802",
      "blockNumber": 5848315,
      "cumulativeGasUsed": 33794,
      "gasUsed": 33794,
      "contractAddress": null,
      "logs": [
        {
          "address": "0x0000000000000000000000000000000000000802",
          "topics": [
            "0x8eea071fb9bda659c167469ca707aae4d94d31d2c948eda86c1d686b018e87f8"
          ],
          "data": "0x0000000000000000000000009eeab1accb1a701aefab00f3b8a...",
          "blockHash": "0xae3e35fb404bac3f87ceb5a8de6a1b7f557c25f7a4cd7d9cc26eb3891567641a",
          "blockNumber": 5848315,
          "transactionHash": "0x69a7a8ee26c1ff14a848f4eeb11b7754347f729ebe61fff223b42eb773e7064d",
          "transactionIndex": 0,
          "logIndex": 0,
          "transactionLogIndex": "0x0",
          "removed": false
        }
      ],
      "logsBloom": "0x00000000000000000000001...",
      "status": 1,
      "effectiveGasPrice": 102000000000,
      "type": 2
    }
  }
  ```

  ```python Substrate Unsigned Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  permission_id = "392a18cb-9de1-4f41-82fd-7ed1b1e8"

  response = sdk.rbac.disable_permission(permission_id=permission_id)
  ```

  ```python Substrate Unsigned Call Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC disable permission call for permission 392a18cb-9de1-4f41-82fd-7ed1b1e8. You must sign and send externally.",
    "call": {
      "value": {
        "call_module": "PeaqRbac",
        "call_function": "disable_permission",
        "call_args": {
          "permission_id": "392a18cb-9de1-4f41-82fd-7ed1b1e8"
        }
      }
    }
  }
  ```

  ```python Substrate Write Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )

  permission_id = "6e100511-7cc1-4365-b18e-d7b0f3ce"

  response = sdk.rbac.disable_permission(permission_id=permission_id)
  ```

  ```python Substrate Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully disabled permission 6e100511-7cc1-4365-b18e-d7b0f3ce.",
    "receipt": {
      "extrinsic_hash": "0x8f3759de5fb02d8a35d00d0d0199dd77b2ebb39fbbb12b71246ac01766ac772e",
      "block_hash": "0x0f961991f807a99d6cd58f4dd55e2a6682cf78ed07904a73f4f205c2988009d4",
      "finalized": false,
      "events": [...],
      "is_success": true,
      "total_fee_amount": 2138997212130607
    }
  }
  ```
</CodeGroup>

## assign\_permission\_to\_role(permission\_id, role\_id)

Assigns a permission to a role, granting the role the capabilities defined by the permission.

| Parameter          | Type  | EVM      | Substrate | Description                                                 |
| ------------------ | ----- | -------- | --------- | ----------------------------------------------------------- |
| **permission\_id** | `str` | Required | Required  | ID of the permission to assign (32 characters).             |
| **role\_id**       | `str` | Required | Required  | ID of the role to assign the permission to (32 characters). |

### Assign Permission to Role Code Examples

<CodeGroup>
  ```python EVM Unsigned Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  permission_id = "307a081a-45e5-4ca3-b2b5-566ceb31"
  role_id = "0bb60413-ebdd-44fb-ab2c-e7e0714f"

  response = sdk.rbac.assign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python EVM Unsigned Tx Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC assign permission to role call for permission 307a081a-45e5-4ca3-b2b5-566ceb31 and role 0bb60413-ebdd-44fb-ab2c-e7e0714f. You must sign and send externally.",
    "tx": {
      "to": "0x0000000000000000000000000000000000000802",
      "data": "0x404147f133303761303831612d343565352d3463613..."
    }
  }
  ```

  ```python EVM Write Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )

  permission_id = "290506fd-b316-4a10-bd33-e8e2e047"
  role_id = "afd2ae0e-b1db-42b9-bca1-93e9328b"

  response = sdk.rbac.assign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python EVM Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully assigned permission 290506fd-b316-4a10-bd33-e8e2e047 to role afd2ae0e-b1db-42b9-bca1-93e9328b.",
    "receipt": {
      "transactionHash": "0x7ef5672c39ef7b46b513ee63612fdc0557bc089dbeba8766ff1d61e1ce74c573",
      "transactionIndex": 0,
      "blockHash": "0xf56a4cfbbc5fdab452cc32601c64e743495a0eb6736b1f5b8d5e9c178a0bb933",
      "from": "0x9Eeab1aCcb1A701aEfAB00F3b8a275a39646641C",
      "to": "0x0000000000000000000000000000000000000802",
      "blockNumber": 5848033,
      "cumulativeGasUsed": 42101,
      "gasUsed": 42101,
      "contractAddress": null,
      "logs": [
        {
          "address": "0x0000000000000000000000000000000000000802",
          "topics": [
            "0xa02facfb294d21b16df2ffafbdd4e2052e6340881efccdbc403226b8cd2faabb"
          ],
          "data": "0x0000000000000000000000009eeab1accb1a701aefab00f3b8a275a39646...",
          "blockHash": "0xf56a4cfbbc5fdab452cc32601c64e743495a0eb6736b1f5b8d5e9c178a0bb933",
          "blockNumber": 5848033,
          "transactionHash": "0x7ef5672c39ef7b46b513ee63612fdc0557bc089dbeba8766ff1d61e1ce74c573",
          "transactionIndex": 0,
          "logIndex": 0,
          "transactionLogIndex": "0x0",
          "removed": false
        }
      ],
      "logsBloom": "0x000000000000000000000000000000000000000000000...",
      "status": 1,
      "effectiveGasPrice": 102000000000,
      "type": 2
    }
  }
  ```

  ```python Substrate Unsigned Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  permission_id = "392a18cb-9de1-4f41-82fd-7ed1b1e8"
  role_id = "bc3a3e43-6f2e-4e55-83d3-72d5148a"

  response = sdk.rbac.assign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python Substrate Unsigned Call Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC assign permission to role call for permission 392a18cb-9de1-4f41-82fd-7ed1b1e8 and role bc3a3e43-6f2e-4e55-83d3-72d5148a. You must sign and send externally.",
    "call": {
      "value": {
        "call_module": "PeaqRbac",
        "call_function": "assign_permission_to_role",
        "call_args": {
          "permission_id": "392a18cb-9de1-4f41-82fd-7ed1b1e8",
          "role_id": "bc3a3e43-6f2e-4e55-83d3-72d5148a"
        }
      }
    }
  }
  ```

  ```python Substrate Write Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )

  permission_id = "6e100511-7cc1-4365-b18e-d7b0f3ce"
  role_id = "06856fab-c5ff-40cd-8e83-634264c6"

  response = sdk.rbac.assign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python Substrate Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully assigned permission 6e100511-7cc1-4365-b18e-d7b0f3ce to role 06856fab-c5ff-40cd-8e83-634264c6.",
    "receipt": {
      "extrinsic_hash": "0x6ed4828323df51efa9a7fd0f3ba2f1bbb30801bea1da497da96afcbddea0b2f5",
      "block_hash": "0x8a2d5c8336d8c2bd2787d4432aa7784f8716218234e83409278d32cb6ee4e4ef",
      "finalized": false,
      "extrinsic": {
        "address": "5Df42mkztLtkksgQuLy4YV6hmhzdjYvDknoxHv1QBkaY12Pg",
        "nonce": 1902,
        "call": {
          "module": "PeaqRbac",
          "function": "assign_permission_to_role",
          "args": {
            "permission_id": "0x36653130303531312d376363312d343336352d623138652d6437623066336365",
            "role_id": "0x30363835366661622d633566662d343063642d386538332d3633343236346336"
          }
        }
      },
      "events": [...],
      "success": true,
      "total_fee": 2412372923063492
    }
  }
  ```
</CodeGroup>

## fetch\_role\_permissions(owner, role\_id)

Fetches all permissions assigned to a role.

| Parameter    | Type  | EVM      | Substrate | Description                                              |
| ------------ | ----- | -------- | --------- | -------------------------------------------------------- |
| **owner**    | `str` | Required | Required  | Address representing the owner.                          |
| **role\_id** | `str` | Required | Required  | ID of the role to fetch permissions for (32 characters). |

### Fetch Role Permissions Code Examples

<CodeGroup>
  ```python EVM Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_ADDRESS = os.getenv("EVM_ADDRESS")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  role_id = "afd2ae0e-b1db-42b9-bca1-93e9328b"

  response = sdk.rbac.fetch_role_permissions(
      owner=EVM_ADDRESS,
      role_id=role_id
  )
  ```

  ```python EVM Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "permission": "290506fd-b316-4a10-bd33-e8e2e047",
      "role": "afd2ae0e-b1db-42b9-bca1-93e9328b"
    }
  ]
  ```

  ```python Substrate Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_ADDRESS = os.getenv("SUBSTRATE_ADDRESS")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  role_id = "06856fab-c5ff-40cd-8e83-634264c6"

  response = sdk.rbac.fetch_role_permissions(
      owner=SUBSTRATE_ADDRESS,
      role_id=role_id
  )
  ```

  ```python Substrate Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "permission": "6e100511-7cc1-4365-b18e-d7b0f3ce",
      "role": "06856fab-c5ff-40cd-8e83-634264c6"
    }
  ]
  ```
</CodeGroup>

## unassign\_permission\_to\_role(permission\_id, role\_id)

Removes a permission from a role, revoking the role's access to the permission's capabilities.

| Parameter          | Type  | EVM      | Substrate | Description                                                     |
| ------------------ | ----- | -------- | --------- | --------------------------------------------------------------- |
| **permission\_id** | `str` | Required | Required  | ID of the permission to unassign (32 characters).               |
| **role\_id**       | `str` | Required | Required  | ID of the role to unassign the permission from (32 characters). |

### Unassign Permission from Role Code Examples

<CodeGroup>
  ```python EVM Unsigned Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM
  )

  permission_id = "307a081a-45e5-4ca3-b2b5-566ceb31"
  role_id = "0bb60413-ebdd-44fb-ab2c-e7e0714f"

  response = sdk.rbac.unassign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python EVM Unsigned Tx Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC unassign permission from role call for permission 307a081a-45e5-4ca3-b2b5-566ceb31 and role 0bb60413-ebdd-44fb-ab2c-e7e0714f. You must sign and send externally.",
    "tx": {
      "to": "0x0000000000000000000000000000000000000802",
      "data": "0xba427c9e33303761303831612d343..."
    }
  }
  ```

  ```python EVM Write Tx theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )

  permission_id = "290506fd-b316-4a10-bd33-e8e2e047"
  role_id = "afd2ae0e-b1db-42b9-bca1-93e9328b"

  response = sdk.rbac.unassign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python EVM Write Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully unassigned permission 290506fd-b316-4a10-bd33-e8e2e047 from role afd2ae0e-b1db-42b9-bca1-93e9328b.",
    "receipt": {
      "transactionHash": "0xcfc2d4b8cf66199316189377dad8649e806359d8c68efc5edb90c03d32f5edf9",
      "transactionIndex": 0,
      "blockHash": "0x0cf3a17ddd238f091767129373d937da66362ed36fbca2b38f1de73139140bd4",
      "from": "0x9Eeab1aCcb1A701aEfAB00F3b8a275a39646641C",
      "to": "0x0000000000000000000000000000000000000802",
      "blockNumber": 5848093,
      "cumulativeGasUsed": 39880,
      "gasUsed": 39880,
      "contractAddress": null,
      "logs": [
        {
          "address": "0x0000000000000000000000000000000000000802",
          "topics": [
            "0x0a5a672f8e6387c8c1f9aa25df37fd046981403d96ac60f5b4e27578486db14c"
          ],
          "data": "0x0000000000000000000000009eeab1accb1a701aefab00f3b8a275a3...",
          "blockHash": "0x0cf3a17ddd238f091767129373d937da66362ed36fbca2b38f1de73139140bd4",
          "blockNumber": 5848093,
          "transactionHash": "0xcfc2d4b8cf66199316189377dad8649e806359d8c68efc5edb90c03d32f5edf9",
          "transactionIndex": 0,
          "logIndex": 0,
          "transactionLogIndex": "0x0",
          "removed": false
        }
      ],
      "logsBloom": "0x000000000000000000000000000000000000...",
      "status": 1,
      "effectiveGasPrice": 102000000000,
      "type": 2
    }
  }
  ```

  ```python Substrate Unsigned Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE
  )

  permission_id = "392a18cb-9de1-4f41-82fd-7ed1b1e8"
  role_id = "bc3a3e43-6f2e-4e55-83d3-72d5148a"

  response = sdk.rbac.unassign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python Substrate Unsigned Call Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Constructed RBAC unassign permission from role call for permission 392a18cb-9de1-4f41-82fd-7ed1b1e8 and role bc3a3e43-6f2e-4e55-83d3-72d5148a. You must sign and send externally.",
    "call": {
      "value": {
        "call_module": "PeaqRbac",
        "call_function": "unassign_permission_to_role",
        "call_args": {
          "permission_id": "392a18cb-9de1-4f41-82fd-7ed1b1e8",
          "role_id": "bc3a3e43-6f2e-4e55-83d3-72d5148a"
        }
      }
    }
  }
  ```

  ```python Substrate Write Call theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )

  permission_id = "6e100511-7cc1-4365-b18e-d7b0f3ce"
  role_id = "06856fab-c5ff-40cd-8e83-634264c6"

  response = sdk.rbac.unassign_permission_to_role(
      permission_id=permission_id,
      role_id=role_id
  )
  ```

  ```python Substrate Signed Call Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  {
    "message": "Successfully unassigned permission 6e100511-7cc1-4365-b18e-d7b0f3ce from role 06856fab-c5ff-40cd-8e83-634264c6.",
    "receipt": {
      "extrinsic_hash": "0xa03cf6d5e0e00f7205b4e445f1b1a2b03bbe4bd0ff3ee98755c654efb4b2896c",
      "block_hash": "0x2645b98668cdce99b4548724c2572ee04d7d1221634ffe50025db287902d8f3f",
      "finalized": false,
      "extrinsic_idx": 2,
      "extrinsic": {
        "extrinsic_hash": "0xa03cf6d5e0e00f7205b4e445f1b1a2b03bbe4bd0ff3ee98755c654efb4b2896c",
        "extrinsic_length": 170,
        "address": "5Df42mkztLtkksgQuLy4YV6hmhzdjYvDknoxHv1QBkaY12Pg",
        "signature": {
          "Sr25519": "0xfad2c64fe6eca2560b491fd59b69ea2f58406109be303228abc8ae8bbecb9477f0b478178aa8df1626d5f3d4f976d1d11e614d6b3b38f12cc2650ca7f1881885"
        },
        "era": "00",
        "nonce": 1903,
        "tip": 0,
        "mode": {
          "mode": "Disabled"
        },
        "call": {
          "call_index": "0x670f",
          "call_function": "unassign_permission_to_role",
          "call_module": "PeaqRbac",
          "call_args": [
            {
              "name": "permission_id",
              "type": "EntityId",
              "value": "0x36653130303531312d376363312d343336352d623138652d6437623066336365"
            },
            {
              "name": "role_id",
              "type": "EntityId",
              "value": "0x30363835366661622d633566662d343063642d386538332d3633343236346336"
            }
          ],
          "call_hash": "0xbc4f82b157963f903724fca83e7a662752fec88b912c6582970b6efd530f9e9f"
        }
      },
      "events": [...],
      "success": true,
      "total_fee": 2334479631311760
    }
  }
  ```
</CodeGroup>

## fetch\_user\_permissions(owner, user\_id)

Fetches all permissions assigned to a user (via roles).

| Parameter    | Type  | EVM      | Substrate | Description                                              |
| ------------ | ----- | -------- | --------- | -------------------------------------------------------- |
| **owner**    | `str` | Required | Required  | Address representing the owner.                          |
| **user\_id** | `str` | Required | Required  | ID of the user to fetch permissions for (32 characters). |

In order to fetch a user permission the following flow must take place:

1. Assign permission to role
2. Assign role to user
3. Fetch user permissions

The following code shows this flow.

### Fetch User Permissions Code Examples

<CodeGroup>
  ```python EVM Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_ADDRESS = os.getenv("EVM_ADDRESS")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )

  permission_id = "290506fd-b316-4a10-bd33-e8e2e047"
  role_id = "afd2ae0e-b1db-42b9-bca1-93e9328b"

  sdk.rbac.assign_permission_to_role(permission_id=permission_id, role_id=role_id)

  user_id = "9e8c7866-8435-4b76-8683-709a03c9"
  sdk.rbac.assign_role_to_user(user_id=user_id, role_id=role_id)

  response = sdk.rbac.fetch_user_permissions(
      owner=EVM_ADDRESS,
      user_id=user_id
  )
  ```

  ```python EVM Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "id": "763207f6-32ef-4236-969d-d1b81ac4",
      "name": "peaq-permission-2",
      "enabled": true
    },
    {
      "id": "290506fd-b316-4a10-bd33-e8e2e047",
      "name": "updated-permission-1",
      "enabled": true
    }
  ]
  ```

  ```python Substrate Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_ADDRESS = os.getenv("SUBSTRATE_ADDRESS")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )

  permission_id = "6e100511-7cc1-4365-b18e-d7b0f3ce"
  role_id = "06856fab-c5ff-40cd-8e83-634264c6"

  sdk.rbac.assign_permission_to_role(permission_id=permission_id, role_id=role_id)

  user_id = "9e8c7866-8435-4b76-8683-709a03c9"
  sdk.rbac.assign_role_to_user(user_id=user_id, role_id=role_id)

  response = sdk.rbac.fetch_user_permissions(
      owner=SUBSTRATE_ADDRESS,
      user_id=user_id
  )
  ```

  ```python Substrate Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "id": "6e100511-7cc1-4365-b18e-d7b0f3ce",
      "name": "updated-permission-1",
      "enabled": true
    },
    {
      "id": "fc49ee05-f0ad-47ce-b336-62efdfec",
      "name": "peaq-permission-2",
      "enabled": true
    }
  ]
  ```
</CodeGroup>

## fetch\_group\_permissions(owner, group\_id)

Fetches all permissions assigned to a group (via roles).

| Parameter     | Type  | EVM      | Substrate | Description                                               |
| ------------- | ----- | -------- | --------- | --------------------------------------------------------- |
| **owner**     | `str` | Required | Required  | Address representing the owner.                           |
| **group\_id** | `str` | Required | Required  | ID of the group to fetch permissions for (32 characters). |

In order to fetch a group permission the following flow must take place:

1. Assign permission to role
2. Assign role to group
3. Fetch group permissions

The following code shows this flow.

### Fetch Group Permissions Code Examples

<CodeGroup>
  ```python EVM Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
  EVM_ADDRESS = os.getenv("EVM_ADDRESS")
  EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

  sdk = Sdk.create_instance(
      base_url=HTTPS_PEAQ_URL,
      chain_type=ChainType.EVM,
      seed=EVM_PRIVATE_KEY
  )

  permission_id = "290506fd-b316-4a10-bd33-e8e2e047"
  role_id = "afd2ae0e-b1db-42b9-bca1-93e9328b"

  sdk.rbac.assign_permission_to_role(permission_id=permission_id, role_id=role_id)

  group_id = "38c9ccb3-2346-4b25-ab28-51e1e2e3"
  sdk.rbac.assign_role_to_group(group_id=group_id, role_id=role_id)

  response = sdk.rbac.fetch_group_permissions(
      owner=EVM_ADDRESS,
      group_id=group_id
  )
  ```

  ```python EVM Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "id": "290506fd-b316-4a10-bd33-e8e2e047",
      "name": "updated-permission-1",
      "enabled": true
    }
  ]
  ```

  ```python Substrate Read theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  import os
  from dotenv import load_dotenv
  from peaq_sdk import Sdk
  from peaq_sdk.types import ChainType

  load_dotenv()

  WSS_PEAQ_URL = os.getenv("WSS_PEAQ_URL")
  SUBSTRATE_ADDRESS = os.getenv("SUBSTRATE_ADDRESS")
  SUBSTRATE_SEED = os.getenv("SUBSTRATE_SEED")

  sdk = Sdk.create_instance(
      base_url=WSS_PEAQ_URL,
      chain_type=ChainType.SUBSTRATE,
      seed=SUBSTRATE_SEED
  )

  permission_id = "6e100511-7cc1-4365-b18e-d7b0f3ce"
  role_id = "06856fab-c5ff-40cd-8e83-634264c6"

  sdk.rbac.assign_permission_to_role(permission_id=permission_id, role_id=role_id)

  group_id = "1801710e-b83b-4f1e-ba91-f7d53dd2"
  sdk.rbac.assign_role_to_group(group_id=group_id, role_id=role_id)

  response = sdk.rbac.fetch_group_permissions(
      owner=SUBSTRATE_ADDRESS,
      group_id=group_id
  )
  ```

  ```python Substrate Response theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
  [
    {
      "id": "6e100511-7cc1-4365-b18e-d7b0f3ce",
      "name": "updated-permission-1",
      "enabled": true
    }
  ]
  ```
</CodeGroup>
