Select to view content in your preferred language

Create User for AGO 'Unable to Create <username>' error.

05-13-2021 03:20 PM
New Contributor

I am using the Python package to create a script that should create AGO users.

When testing the package, I create the GIS object using my account details (I have admin role) and then create the new user, but an "Unable to create <username>" error is thrown.

When investigating the issue, it seems when the package sends the post request, the username is returned in the "notInvited" list and thus the user creation fails. I tried using a real email but it still fails.

I have searched the web for a while now and have found no solutions to this problem.


# school is replaced by my school name, xxx and yyy are my username and password
gis = GIS(url='', username='xxx', password='yyy')

    newuser = gis.users.create(


Thank you in advance!

0 Kudos
3 Replies
MVP Esteemed Contributor

Looking at the API docs, it would appear that the user_type is a required string. Try your same code but with "user_type='Viewer'"added to the parameters.

- Josh Carlson
Kendall County GIS
New Contributor

I was facing the same issue mentioned above and was able to resolve it by adding the user_type and the role syntax. Now how to know which user_type and role to add, refer to the following documentation (Create User—ArcGIS REST APIs | ArcGIS Developers). Check sections "role" and "userLicenseTypeId".

Example = I am creating a new user with role (Viewer) and user type (Viewer). As per the above cited documentation I will use role as "iAAAAAAAAAAAAAAA" and user_type as "viewerUT". Hope this helps.

Occasional Contributor III

@JPGarCar This is old old old does one review the requests the .create() call is making? I'm having a similar problem, which is how I found myself to this post. The difference is that I had my code working fine a few days ago and could create users. Now they fail. I'd like to figure out the next phase in troubleshooting and reviewing the requests would help. 

0 Kudos