Api_key and api_username for creating user via API

(Adam Beers) #1

The CURL for creating a user indicates that an api_key and api_username are required. What are those if a user is trying to create a new account and they don’t have a key or username? They shouldn’t be the admin values, but I can’t figure out what they should be.

curl -X POST --data "name=dave&username=dave&email=dave@example.com&password=P@ssword&active=true" http://localhost:3000/users?api_key=test_d7fd0429940&api_username=test_user

(Simon Cossar) #2

I think you need to pass the api key and username as part of the POST data.

Here’s a php example:

(Blake Erickson) #3

Are you saying a new user will sign up via the API or do you want to create new users yourself via the api?

If you are the one creating the users you would use your admin api_key.

If a user is trying to sign up via the api I’m not sure how to make a POST request to /users without an api key.

(Mittineague) #4

If it is possible for other than the Admin to create accounts using the API the way to do it eludes me.


  • to use the API a key is required
  • to generate a key an account is required

(Simon Cossar) #5

The example you are showing is from the Discourse API Documentation. I think there was an error in that. That topic is a wiki, so I’ve made an edit to it. My understanding it that the api_key and api_username need to be passed as POST data, not as a query string.