# When using the management API, how to know if user already existed or s new?

**URL:** <https://community.auth0.com/t/when-using-the-management-api-how-to-know-if-user-already-existed-or-s-new/52634>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [November 3, 2020, 11:10am UTC](https://community.auth0.com/t/when-using-the-management-api-how-to-know-if-user-already-existed-or-s-new/52634 "2020-11-03T11:10:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexab/32/13403_2.png) [@alexab](https://community.auth0.com/u/alexab)\
**Post date:** [November 3, 2020, 11:10am UTC](https://community.auth0.com/t/when-using-the-management-api-how-to-know-if-user-already-existed-or-s-new/52634/1 "2020-11-03T11:10:18Z")

</div>

I’m using [this endpoint](https://auth0.com/docs/api/management/v2#!/Users/post_users) to create users with the management API. How can I know if the user already exists, or is newly created?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 3, 2020, 11:24pm UTC](https://community.auth0.com/t/when-using-the-management-api-how-to-know-if-user-already-existed-or-s-new/52634/3 "2020-11-03T23:24:23Z")

</div>

Hey @alexab,

You’ll get a `409	User already exists.` error.

---

<div class="post-metadata">

**Author:** ![alexab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexab/32/13403_2.png) [@alexab](https://community.auth0.com/u/alexab)\
**Post date:** [November 4, 2020, 8:01am UTC](https://community.auth0.com/t/when-using-the-management-api-how-to-know-if-user-already-existed-or-s-new/52634/4 "2020-11-04T08:01:01Z")

</div>

Hi @dan.woda - ok, I guess the behaviour I’m seeing is caused by the Auth0 Node.js wrapper then - because no error is thrown there. I will create an issue on the repo then.

**Update** - just checked the repo, and found this [comment](https://github.com/auth0/node-auth0/issues/333#issuecomment-461642966) that explains.

So in other words, the `409 User already exists` is only thrown if connection is not e-mail, otherwise the existing user is just returned. It’s not supposed to be easy 😌

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 4, 2020, 8:06pm UTC](https://community.auth0.com/t/when-using-the-management-api-how-to-know-if-user-already-existed-or-s-new/52634/5 "2020-11-04T20:06:46Z")

</div>

> [@alexab](#):
>
> So in other words, the `409 User already exists` is only thrown if connection is not e-mail, otherwise the existing user is just returned. It’s not supposed to be easy 🙂

That is certainly interesting…thanks for taking a moment to clarify.

---

<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:** [November 19, 2020, 8:06pm UTC](https://community.auth0.com/t/when-using-the-management-api-how-to-know-if-user-already-existed-or-s-new/52634/6 "2020-11-19T20:06:47Z")

</div>

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