I would start here: How to reverse engineer the Discourse API. For details about creating users, have a look at https://docs.discourse.org/. Search for ‘user’ in the docs to get details about how to create a user via the API.
There is also a lot of information available in posts on Meta. Here’s a search to get you started with that: Search results for 'create user API' - Discourse Meta.