Title: Cannot update user role through REST API (rest_user_invalid_role)
Last modified: October 14, 2022

---

# Cannot update user role through REST API (rest_user_invalid_role)

 *  Resolved [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * (@blutarsky)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/cannot-update-user-role-through-rest-api/)
 * Hello, I have created a custom role named ‘User Manager’, which is used only 
   to run REST API calls. Custom role allows creating users (it works) and should
   also update user roles (doesn’t work)
 * User Manager granted rights:
 *     ```
       Read
       Create Roles	
       Create Users	
       Delete Roles	
       Delete Users	
       Edit Roles	
       Edit Users	
       List Roles	
       List Users	
       Promote Users	
       Remove Users
       ure_edit_roles
       ```
   
 * When creating a user as for endpoint `/wp/v2/users`, WITHOUT specifying user 
   role, the user creation will succeed, and user will be created with role ‘subscriber’.
 * As soon as user creation will include the `roles` parameter, an error is thrown:
 * http returned code: `rest_user_invalid_role`
    http returned text; `Sorry, you
   are not allowed to give users that role` status: `403`
 * The error seems to be fired [here](https://developer.wordpress.org/reference/classes/wp_rest_users_controller/check_role_update/)
 * What permission are missing in your opinion?
    -  This topic was modified 3 years, 8 months ago by [Blutarsky](https://wordpress.org/support/users/blutarsky/).
    -  This topic was modified 3 years, 8 months ago by [Blutarsky](https://wordpress.org/support/users/blutarsky/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * (@blutarsky)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/cannot-update-user-role-through-rest-api/#post-16098959)
 * It looks like roles cannot be set on user creation! Can only be edited on existing
   user. We can close this

Viewing 1 replies (of 1 total)

The topic ‘Cannot update user role through REST API (rest_user_invalid_role)’ is
closed to new replies.

 * ![](https://ps.w.org/members/assets/icon-256x256.png?rev=3508404)
 * [Members - Membership & User Role Editor Plugin](https://wordpress.org/plugins/members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/members/)
 * [Active Topics](https://wordpress.org/support/plugin/members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/members/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/cannot-update-user-role-through-rest-api/#post-16098959)
 * Status: resolved