# How can I update users via API using the user id (not username)?

**URL:** <https://meta.discourse.org/t/how-can-i-update-users-via-api-using-the-user-id-not-username/170203>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [November 15, 2020, 5:06pm UTC](https://meta.discourse.org/t/how-can-i-update-users-via-api-using-the-user-id-not-username/170203 "2020-11-15T17:06:09Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![wilson29thid](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wilson29thid/32/173700_2.png) [@wilson29thid](https://meta.discourse.org/u/wilson29thid)\
**Post date:** [November 15, 2020, 5:06pm UTC](https://meta.discourse.org/t/how-can-i-update-users-via-api-using-the-user-id-not-username/170203/1 "2020-11-15T17:06:09Z")

</div>

I’d like my application to update my users’ linked discourse account: specifically the display name and groups the user is a member of (e.g. when they’re promoted in my application, they’re added to another forum group as well).

I expected to store a “discourse member id” reference in my application’s users table, and use that to make updates, e.g. `POST /users/{id}.json` with a payload like `{"name": "new name"}`. But it looks like all the API routes expect a `username` instead of an `id`.

I don’t understand why this would be the default: can’t users change their username? It seems like that would break the integration if they did.

How can I make changes like this reliably, using a consistent identifier (like `id`)?

---

_[View the full topic](https://meta.discourse.org/t/how-can-i-update-users-via-api-using-the-user-id-not-username/170203)._
