latestOpenAPI 3.0.12026-08-20112309904.6 KB
466169815b78
Users - Roles
Assign new roles to a user
Overview
Assign one or more roles to an existing user.
Use Cases
- Privilege Escalation: Grant a user additional management permissions.
- Onboarding: Finalize a user's access setup by adding specific functional roles.
Identification
The {userId} is a unique numerical identifier.
Getting User ID
- To find users and their numerical IDs, use the Users Management API:
- GET /public/v1/users - Retrieve all users with their id field.
- The id field in the user response is the {userId} used in this endpoint's path parameter.
Behavior
- Additive: This operation only adds new roles. It will not remove or overwrite existing roles.
- Validation: Every role name provided must be valid and assigned to your organization. If even one role name is invalid, the entire request will fail (atomic operation).
Workflow Tip
Call List Available Roles first to ensure you are using correct role names.
Related Operations
- List Current Roles: GET /public/v1/users/{userId}/roles
- Remove Role: DELETE /public/v1/users/{userId}/roles/{roleName}
Required Permission
manage_public_users
post/public/v1/users/{userId}/roles
Path parameters
userIdinteger required
The unique numerical identifier of the target user. If you do not have this ID, you can find it by searching for the user via GET /public/v1/users.
Request body
string[] required
Response
Created - Roles successfully added. Returns the full, updated list of user roles.