Skip to main content

"assignRolesToAccounts" (JSON Action)

Add and remove accounts from roles

Links: Concepts | Tutorials | FAQs

Request examples

{
  "api": "admin",
  "action": "assignRolesToAccounts",
  "params": {
    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1",
          "NewAccount2"
        ]
      }
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "api": "admin",
  "action": "assignRolesToAccounts",
  "params": {
    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ],
    "remove": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount2"
        ]
      }
    ]
  },
  "requestId": "1",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "assignRolesToAccounts" API allows administrators to modify user account roles by adding or removing them. Requests use "params" with "add" and "remove" objects to specify roles and users. "Add" and "remove" properties are arrays of objects, each containing "rolenames" and "usernames". The summary table outlines these properties, their descriptions, defaults, types, and limitations for both adding and removing roles.

assignRolesToAccountsassignRoleToAccountassignRoleToAccountsassignsRoleToAccountassignsRolesToAccountsassign role to accountadmin APIAPI actionJSON ADMIN APIJSON Actionadd user rolesremove user rolesuser role managementrole namesadmin actions
Table 1. assignRolesToAccounts "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

add

(optional) specifies which roles will be added to which accounts.

{}

array of objects

"rolenames"
"usernames"
add
.roleNames

(optional) specifies the roles to be added to the accounts.

[]

array

1 or more strings, each between 1 and 64 bytes.

add
.usernames

(optional) specifies which account will receive the roles.

[]

array

1 or more strings, each between 1 and 64 bytes.

remove

(optional) specifies which roles will be added to which accounts.

{}

array of objects

"rolenames"
"usernames"
remove
.roleNames

(optional) specifies the roles to be removed from the accounts.

[]

array

1 or more strings, each between 1 and 64 bytes.

remove
.usernames

(optional) specifies which accounts will receive the roles.

[]

array

1 or more strings, each between 1 and 64 bytes.



The "add" property is an array of objects that specifies which roles will be added to which accounts. You can specify the roles you want to add with the "rolenames" property and the accounts that will be assigned those roles with the "usernames" property.

The "roleNames" property specifies the roles to be added to or deleted from the accounts specified by the "usernames" property. This property can specify one or more roles, each between 1 and 64 bytes.

    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ]

The "usernames" property specifies which accounts the roles specified by the "roleNames" property should be added to or deleted from. This property can specify one or more roles, each between 1 and 64 bytes

    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ]

The "remove" property is an array of objects that specifies which roles will be removed from which accounts. You can specify the roles you want to remove with the "rolenames" property and the accounts to remove them from with the "usernames" property.

The "roleNames" property specifies the roles to be added to or deleted from the accounts specified by the "usernames" property. This property can specify one or more roles, each between 1 and 64 bytes.

    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ]

The "usernames" property specifies which accounts the roles specified by the "roleNames" property should be added to or deleted from. This property can specify one or more roles, each between 1 and 64 bytes

    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ]