Creating users through

Hello @Daniel, @matthias

Slightly urgent issue here with regards to creating new users. Now the endpoint has been removed, can we create and activate new users through the API? I see the functionality no longer works on and we are needing this very shortly for the treasure project.

If the method is through the /users endpoint I will still need an Api-Key and Api-Username with the appropriate privileges to create the user - which I do not have — well as a method to activate the account for the user in order to post using their account.

cc @Ivan @bojanbobic

I just discussed the issue with Daniel and we found a suitable solution that Daniel will try to implement and deploy tomorrow (should work, but no guarantees until it is actually deployed and confirmed by Daniel here).

In effect, there will be a new API endpoint on the site, taking over the role of the former endpoint and having more or less the same interface. The difference will be that it only creates accounts on the site itself, since the whole multisite system has been abandoned now.

1 Like

Thanks Matt!

@owen is the /multisite_account_api_key.json endpoint still in use / required?

@Daniel No, only the /multisite_account.json endpoint is being used.

Ok great, I’ll finish testing and upload the fixed plugin in the next minutes…

Great, thank you! There should be no CORS restrictions, so the endpoint could be called from - correct?

New plugin version is now deployed. I was was able to create a testuser on the site. The interface of the /multisite_account.json stayed the same as well as the auth_key that must be part of the payload.
Please let me know if it works for you.

Thanks @daniel

I’ve had a go at implementing this and the user creation works, which is great, but I am now having an issue using the returned user api key to make a post.

This shouldn’t be an issue normally as the /posts endpoint works fine for existing users posting comments on, so I dug into it a bit and found that the new users being created had not accepted the consent funnel questions on the platform - ie I had to manually accept them by logging into the platform - then posting was possible.

Here is the function that creates a user:

const createUser = (form) =>
      accepted_gtc: true,
      accepted_privacy_policy: true,
      edgeryders_research_consent: true,
      requested_api_keys: [discourseDomain],
      auth_key: discourseAuthKey,
      username: generateUsername(,
      password: generatePassword(16)
      .map((pair) =>'='))
  ).then(handleResponse(errorMessages), handleNetworkError(errorMessages))

both accepted_privacy_policy and edgeryders_research_consent are set to true as you can see, so I’m wondering if the new endpoint isn’t ignoring these booleans when creating an account?

Much thanks for your help.

Turns out edgeryders_research_consent is evaluated to be true but not persisted. Now working to fix it. I’ll let you know as soon as it’s done.

1 Like

Fix is now deployed. Also tested to create a user on with the API and edgeryders_research_consent is now properly persisted in the database.

1 Like

Thank you for your help @Daniel, everything is working now.

As we are using this for onboarding new members through the next month, we need a confirmation email to be sent when a new account is created through the API. It appears this isn’t the case - an account can be created and used to post - but unless the person notes down their username / password, there is no record of their account being made. Could we implement this in the API call?

cc @Ivan @bojanbobic

Yes, I’ll implement it in the next days and post here when done.

1 Like

This is now deployed @owen. An email is sent to the user upon account creation with the following content:

  Welcome to Edgeryders,

  a new account was created for you at

  Login Information:
  - Username: %{username}
  - Email: %{email}

  Please use either your username or email, along with your password, to log in to your account.

Please let me know if this is sufficient.

1 Like

Thank you Daniel, perfect!

Hello @Daniel - sorry, I tested and it looks like there is now an error when accounts are created:

Error: invalid json response body at************&
HaRm reason: Unexpected token c in JSON at position 1

I haven’t updated the site on my end, so perhaps this comes from the new changes?

Hello @Owen, sorry about that. I tested account creation in production in the browser and it worked - but I missed that the JSON response was actually a 422 error. This is now fixed.

1 Like