Add user with curl

I need to add users with curl command but I get error Incorrect username or password.
curl -X POST -d “email=new_user@mydomail.com” -d “password=s3curE_pa5Sw0rD” https://…/admin/mail/users/add

Please help me.

The API uses basic authentication. The auth token is a base64 encoded string in format email:password and only admin accounts can add users. You can use the curl --user agument to encode the auth details.

Here’s the relevant curl command:

curl -X POST "https://box.example.com/admin/mail/users/add" -H  "accept: text/html" -H "Content-Type: application/x-www-form-urlencoded" -d "email=user@example.com&password=password&privileges=" --user me@mydomain.com:yourpassword

Thanks for your reply
In the end of command “me@mydomain.com:yourpassword” is Admin account?

Yep!

(Some random text to allow me to reply, ignore this)

Thanks tomorrow test it.

I test your command.
This command works very well.
Thank you so much.

1 Like