Standard Mongo API createUser cannot be used to create database user on Atlas. You may consult
- https://docs.atlas.mongodb.com/reference/unsupported-commands-paid-tier-clusters#std-label-paid-tier-command-limitations
- https://docs.atlas.mongodb.com/reference/free-shared-limitations
- https://docs.atlas.mongodb.com/reference/unsupported-commands
for more information.
However, you may use the Atlas API, https://docs.atlas.mongodb.com/reference/api/database-users-create-a-user to create database user. But as Jack_Woehr mentioned, this might also not work on free tier. For example, you do not have access to server logs on the free tier.