# Update username fails with bad request 400

**URL:** <https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726>\
**Category:** Get Help\
**Created:** [February 4, 2022, 11:38pm UTC](https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726 "2022-02-04T23:38:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathias\_rb](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathias_rb/32/12776_2.png) [@mathias\_rb](https://community.auth0.com/u/mathias_rb)\
**Post date:** [February 4, 2022, 11:38pm UTC](https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726/1 "2022-02-04T23:38:20Z")

</div>

Updating a user’s username using the management API fails with BadRequest error 400.

When I update another property, like the email address, this works fine. But updating the username produces this error.

I have it configured that username is a mandatory field, and I am specifying the connection with the request (Username-Password-Authentication).

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 5, 2022, 12:44am UTC](https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726/3 "2022-02-05T00:44:22Z")

</div>

Hi @mathias_rb,

Welcome to the Auth0 Community!

I understand you encountered issues updating the user’s username.

First, could you clarify if the Username-Password-Authentication database has enabled the **Requires Username** toggle?

If the toggle is disabled, could you please enable the toggle and then retry updating the user with a username.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/9/d/9df6d99e043d26dab2ee2536e64d14442aecb8dd.jpeg)

After doing so, you can update the user with a username using the Management API.

Please let me know if there’s anything else I can do to help.

Thank you.

---

<div class="post-metadata">

**Author:** ![mathias\_rb](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathias_rb/32/12776_2.png) [@mathias\_rb](https://community.auth0.com/u/mathias_rb)\
**Post date:** [February 5, 2022, 6:53am UTC](https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726/4 "2022-02-05T06:53:48Z")

</div>

Hi Rueben,

The “requires username” toggle was already enabled.  
Min length is 1, Max length is 50.

I should mention that CREATING the user through the API works fine. In the CREATE command I also supply the username, and then it gets applied correctly.

It is the UPDATE that fails if I include the username. If I update some properties WITHOUT the username, it is also fine. The new username I am trying to set has only a few characters, so it is within the limits.

Regards

Mathias

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 10, 2022, 12:25am UTC](https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726/5 "2022-02-10T00:25:40Z")

</div>

Hi @mathias_rb,

Thank you for your response.

I have just tested and did not find the same observations. Instead, I managed to update the user’s username with new values, and it worked successfully. I used the Management API’s update a user endpoint and confirmed that it works as expected.

> [@mathias\_rb](#):
>
> It is the UPDATE that fails if I include the username.

In this case, could you please clarify the errors you are getting?

And could you share with me your complete request?

It should look something like the following:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/9/5/95c8c1e47fdf09bb85856869e32ae9e3f0b6a6c2.png)

Thank you.

---

<div class="post-metadata">

**Author:** ![mathias\_rb](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathias_rb/32/12776_2.png) [@mathias\_rb](https://community.auth0.com/u/mathias_rb)\
**Post date:** [February 11, 2022, 4:42pm UTC](https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726/6 "2022-02-11T16:42:56Z")

</div>

Hi Rueben,

OK, I managed to get this to work.

BUT: it only works if I DO NOT update the name and the email in the same request.

Apparently the ONLY property I can specify in this update statement is the username. If I want to update name and email as well, then I have to do that in a separate request.

I did not see that in the documentation.

But thanks for the help, problem solved.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 26, 2022, 4:43pm UTC](https://community.auth0.com/t/update-username-fails-with-bad-request-400/77726/7 "2022-02-26T16:43:47Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
