# Checking For Unique Username via API?

**URL:** <https://meta.discourse.org/t/checking-for-unique-username-via-api/306504>\
**Category:** SSO\
**Tags:** rest-api\
**Created:** [May 2, 2024, 6:07pm UTC](https://meta.discourse.org/t/checking-for-unique-username-via-api/306504 "2024-05-02T18:07:17Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Earnie\_Baird](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/earnie_baird/32/380079_2.png) [@Earnie\_Baird](https://meta.discourse.org/u/Earnie_Baird)\
**Post date:** [May 2, 2024, 6:07pm UTC](https://meta.discourse.org/t/checking-for-unique-username-via-api/306504/1 "2024-05-02T18:07:17Z")

</div>

We are using Discourse with SSO and are creating users via the API.

There is concern that if we leverage the email address for the username it will be easy to guess personal emails at gmail so we’d like to just create unique usernames by using First Name + a Number (eg Bill1, Bill2, Bill3) and users can always change them.

Is there a way to check if a username is unique via the API? The thought is that we can keep looping until we find a username that is unique.

Also would be interested to hear if anyone has any other ideas for an alternate approach. One thought was doing something like First Name + Last Initial + 4 Random numbers or similar.

Thanks

---

_[View the full topic](https://meta.discourse.org/t/checking-for-unique-username-via-api/306504)._
