Invalid Request Payload Input Error during User Role Assignment via Management API

Overview

A 400 error message with the description Invalid request payload input occurs when assigning Roles to a user using the /API/v2/users/{id}/roles endpoint. The same error message can also be seen when troubleshooting the request in the inline tester from the documentation: Assign roles to a user.

Applies To

  • Management API

Cause

The problem is in the string elements of the roles array in the body of the request:

{
"roles": [
"string"
]
}

Solution

For the request to be successful, the roles must be added using the role ID. The Role ID can be obtained by going to the Dashboard > User Management > Roles and clicking on the specific role to view its details.
The role ID is found right below the title:


The Role IDs for your tenant can also be obtained using Management API /api/v2/roles endpoint.

As an example, the Role from the screenshot above can be added like so:

{
"roles": [
"rol_x7wltRcx9aA4adGs"
]
}