# Types of \`user\_id\` allowed?

**URL:** <https://community.auth0.com/t/types-of-user-id-allowed/9011>\
**Category:** Get Help\
**Tags:** user\_id, managment-api-v2\
**Created:** [December 18, 2017, 3:52pm UTC](https://community.auth0.com/t/types-of-user-id-allowed/9011 "2017-12-18T15:52:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.dornseif](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/m.dornseif/32/3831_2.png) [@m.dornseif](https://community.auth0.com/u/m.dornseif)\
**Post date:** [December 18, 2017, 3:52pm UTC](https://community.auth0.com/t/types-of-user-id-allowed/9011/1 "2017-12-18T15:52:08Z")

</div>

I seem to be able to create Users via the management API that I can not retrive.  
user\_ids like `CK10596` and `u22759of6c92c` seem to work fine. But I also have uids like `email@example.com`.

If I want to create a User with the user\_id `email@example.com`twice I get an “400: The user already exists” on the second try - which is correct.  
But If I then try to get the user via `/api/v2/users/email@example.com` I get a “404: The user does not exist.” - so I wonder if I’, there is an API limitation or just encoding issues in the Python Library I use.

Pseudo code is like this:

```
payload = {
    "connection": 'DefaultDatabase',
    "email": credential.email,
    "password": credential.secret,
    "user_id": credential.uid,
}
try:
    newuser = auth0api.users.create(payload)
except Auth0Error as ex:
    if ex.status_code == 400 and ex.message == u'The user already exists.':
        try:
            newuser = auth0api.users.get('auth0|{}'.format(credential.uid))
        except Auth0Error as ex:
            if ex.status_code == 404 and ex.message == u'The user does not exist. ':
                # WTF? First we get told it does exist
                # then they complain it does not?
                return

```

---

<div class="post-metadata">

**Author:** ![m.dornseif](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/m.dornseif/32/3831_2.png) [@m.dornseif](https://community.auth0.com/u/m.dornseif)\
**Post date:** [December 18, 2017, 6:21pm UTC](https://community.auth0.com/t/types-of-user-id-allowed/9011/2 "2017-12-18T18:21:49Z")

</div>

I think it’s an issue with the Python Library. See [https://github.com/auth0/auth0-python/pull/87](https://github.com/auth0/auth0-python/pull/87).

---

<div class="post-metadata">

**Author:** ![m.dornseif](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/m.dornseif/32/3831_2.png) [@m.dornseif](https://community.auth0.com/u/m.dornseif)\
**Post date:** [December 19, 2017, 4:38pm UTC](https://community.auth0.com/t/types-of-user-id-allowed/9011/3 "2017-12-19T16:38:08Z")

</div>

But this still seems not to be the (only) issue.

I still have instances where `auth0api.users.create({'connection': 'DefaultDatabase', 'user_id': u'CK10001', …})` fails with `400: The user already exists`.

But `auth0api.users.get('auth0|CK10001')` fails with `404: The user does not exist.`.

Is there any way to do a “get or insert” or make `auth0api.users.create()` return the conflicting user?

---

<div class="post-metadata">

**Author:** ![m.dornseif](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/m.dornseif/32/3831_2.png) [@m.dornseif](https://community.auth0.com/u/m.dornseif)\
**Post date:** [December 20, 2017, 6:48am UTC](https://community.auth0.com/t/types-of-user-id-allowed/9011/4 "2017-12-20T06:48:01Z")

</div>

The issue is that all users need to have different E-Mail Addresses. See [Multiple usernames with the same email in one connection - Auth0 Community](http://community.auth0.com/questions/1012/multiple-usernames-with-the-same-email-in-one-conn)

---

<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:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/types-of-user-id-allowed/9011/5 "2018-03-02T05:57:51Z")

</div>


