# Unable to update user role

**URL:** <https://forum.mautic.org/t/unable-to-update-user-role/9377>\
**Category:** Product Support\
**Created:** [September 6, 2017, 5:31am UTC](https://forum.mautic.org/t/unable-to-update-user-role/9377 "2017-09-06T05:31:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sreena](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@sreena](https://forum.mautic.org/u/sreena)\
**Post date:** [September 6, 2017, 5:31am UTC](https://forum.mautic.org/t/unable-to-update-user-role/9377/1 "2017-09-06T05:31:36Z")

</div>

Hi,  
  
I am unable to update a user role by using Mautic Api. The following is the code that i had tried .  
  
  
  
$id = 1;  
  
$data = array(  
  
‘lastName’ =\> ‘Doeboe’,  
  
‘role’ =\> 2  
  
);  
  
  
  
$user = $userApi-\>edit($id, $data);

---

<div class="post-metadata">

**Author:** ![sreena](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@sreena](https://forum.mautic.org/u/sreena)\
**Post date:** [September 6, 2017, 5:31am UTC](https://forum.mautic.org/t/unable-to-update-user-role/9377/2 "2017-09-06T05:31:36Z")

</div>

Hi,  
I am unable to update a user role by using Mautic Api. The following is the code that i had tried .

$id = 1;  
$data = array(  
‘lastName’ =\> ‘Doeboe’,  
‘role’ =\> 2  
);

$user = $userApi-\>edit($id, $data);
