Fuselage
Powered By GitBook
Create User Endpoint
Create a new user. Requires create-user permission.
URL
Requires Auth
HTTP Method
/api/v1/users.create
yes
POST
Note
    To save customFields you must first define the customFields in admin panel (Accounts -> Registration -> Custom fields).

Payload

Argument
Example
Required
Description
email
Required
The email address for the user.
name
Example User
Required
The display name of the user.
password
Required
The password for the user.
username
example
Required
The username for the user.
active
false
Optional Default: true
Whether the user is active, which determines if they can login or not.
roles
['bot']
Optional Default: ['user']
The roles the user has assigned to them on creation.
joinDefaultChannels
false
Optional Default: true
Whether the user should join the default channels when created.
requirePasswordChange
true
Optional Default: false
Should the user be required to change their password when they login?
sendWelcomeEmail
true
Optional Default: false
Should the user get a welcome email?
verified
true
Optional Default: false
Should the user's email address be verified when created?
customFields
{ twitter: '@example' }
Optional Default: undefined
Any custom fields the user should have on their account.

Example Call

1
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
2
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
3
-H "Content-type:application/json" \
4
http://localhost:3000/api/v1/users.create \
5
-d '{"name": "name", "email": "[email protected]", "password": "anypassyouwant", "username": "uniqueusername"}'
Copied!

Example Result

1
{
2
"user": {
3
"_id": "BsNr28znDkG8aeo7W",
4
"createdAt": "2016-09-13T14:57:56.037Z",
5
"services": {
6
"password": {
7
"bcrypt": "$2a$10$5I5nUzqNEs8jKhi7BFS55uFYRf5TE4ErSUH8HymMNAbpMAvsOcl2C"
8
}
9
},
10
"username": "uniqueusername",
11
"emails": [
12
{
13
"address": "[email protected]",
14
"verified": false
15
}
16
],
17
"type": "user",
18
"status": "offline",
19
"active": true,
20
"roles": [
21
"user"
22
],
23
"_updatedAt": "2016-09-13T14:57:56.175Z",
24
"name": "name",
25
"settings": {}
26
},
27
"success": true
28
}
Copied!
Note
    The customFields will not be returned if it does not exist on the server.

Change Log

Version
Description
0.48.0
role property is now roles which is an array of strings for the roles to create the user with.
0.45.0
Users created via this now join the default channels.
0.40.0
Added
Last modified 6mo ago
Export as PDF
Copy link