Create Managed User
Create Managed User
To generate a new managed user, the minimal information that will be required will be a name and an email address for the managed user.
cURL
curl -X POST https://api.box.com/2.0/users \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H 'Content-Type: application/json" '
-d '{
"login": "ceo@example.com",
"name": "Aaron Levie"
}'
.NET
var userParams = new BoxUserRequest()
{
Name = "Example User",
Login = "user@example.com"
};
BoxUser newUser = await client.UsersManager.CreateEnterpriseUserAsync(userParams);
Java
BoxUser.Info createdUserInfo = BoxUser.createEnterpriseUser(api, "user@example.com", "A User");
Python
new_user = client.create_user('Dummy User', 'user@example.com')
Node
client.enterprise.addUser(
'eddard@winterfell.example.com',
'Ned Stark',
{
role: client.enterprise.userRoles.COADMIN,
address: '555 Box Lane',
status: client.enterprise.userStatuses.CANNOT_DELETE_OR_EDIT
})
.then(user => {
/* user -> {
type: 'user',
id: '44444',
name: 'Ned Stark',
login: 'eddard@winterfell.example.com',
created_at: '2012-11-15T16:34:28-08:00',
modified_at: '2012-11-15T16:34:29-08:00',
role: 'coadmin',
language: 'en',
timezone: 'America/Los_Angeles',
space_amount: 5368709120,
space_used: 0,
max_upload_size: 2147483648,
status: 'active',
job_title: '',
phone: '',
address: '555 Box Lane',
avatar_url: 'https://www.box.com/api/avatar/large/deprecated' }
*/
});
iOS
client.users.create(login: "new.user@example.com", name: "New User") { (result: Result<User, BoxSDKError>) in
guard case let .success(user) = result else {
print("Error creating user")
return
}
print("Created user \(user.name), with login \(user.login)")
}
To see all available optional parameters that may be set when creating an app user, see the create user endpoint.
A user object will be returned from the create user request. Within the user object is an ID for the managed user, which may be used to make API requests to modify the user in the future.
Once a new managed user is created the email address used will receive an email
from Box asking them to create a password for the account. The account will be
in a pending
state until that action has taken place.