# Create users through API using explicit user ids

**URL:** <https://meta.discourse.org/t/create-users-through-api-using-explicit-user-ids/182078>\
**Category:** Product Support\
**Created:** [March 4, 2021, 6:30pm UTC](https://meta.discourse.org/t/create-users-through-api-using-explicit-user-ids/182078 "2021-03-04T18:30:42Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![vagosduke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vagosduke/32/196991_2.png) [@vagosduke](https://meta.discourse.org/u/vagosduke)\
**Post date:** [March 4, 2021, 6:30pm UTC](https://meta.discourse.org/t/create-users-through-api-using-explicit-user-ids/182078/1 "2021-03-04T18:30:42Z")

</div>

Hello, I’ve been using Discourse API and OAuth2 plugin to migrate and log-in users from my own SSO service to a private Discourse installation. So far, I’ve managed to programmatically migrate all SSO users to discourse successfully. When migrating programmatically, new users are created with an auto-incrementing Discourse-specific id. My question is: Can I use the API to create a user using an explicit id for that user? meaning that, if assign a user to id:22, then I can query him/her with `/admin/users/22.json`

I’ve tried passing ‘id’ and ‘external\_id’ parameters in the POST body, but it won’t work.

edit: also, is there a way through the API, given a specific user id, to change his/her username?

Thank you

---

_[View the full topic](https://meta.discourse.org/t/create-users-through-api-using-explicit-user-ids/182078)._
