Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

Delete user

delete
https://api.box.com/2.0
/users/:user_id

Deletes a user. By default this will fail if the user still owns any content. Move their owned content first before proceeding, or use the force field to delete the user and their files.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The ID of the user.

Query Parameters

booleanin queryoptional
true

Whether the user should be deleted even if this user still own files

booleanin queryoptional
true

Whether the user will receive email notification of the deletion

Response

none

Removes the user and returns an empty response.

application/jsonClient error

An unexpected client error.

delete
Delete user
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X DELETE "https://api.box.com/2.0/users/12345" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.users.deleteUserById(createdUser.id);
Python Gen
client.users.delete_user_by_id(created_user.id)
.NET Gen
await client.Users.DeleteUserByIdAsync(userId: createdUser.Id);
Swift Gen (Beta)
try await client.users.deleteUserById(userId: createdUser.id)
Java
BoxUser user = new BoxUser(api, "0");
user.delete(false, false);
Python
user_id = '33333'
client.user(user_id).delete(force=True)
.NET
await client.UsersManager.DeleteEnterpriseUserAsync("44444", notify: false, force: true);
Node
// Delete the user even if they still have files in their account
client.users.delete('123', {force: true})
    .then(() => {
        // deletion succeeded — no value returned
    });
iOS
client.users.rollOutOfEnterprise(userId: "33333") { (result: Result<User, BoxSDKError>) in
    guard case let .success(user) = result else {
        print("Error removing user from enterprise")
        return
    }

    print("User \(user.name) successfully removed from enterprise")
}