Box Developer Documentation

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

Register now!

Delete user avatar

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

Removes an existing user avatar. You cannot reverse this operation.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The ID of the user.

Response

none
  • no_content: Removes the avatar and returns an empty response.
application/jsonClient error
  • forbidden: Returned if the user does not have necessary permissions or is not activated.
application/jsonClient error
  • not_found: Returned if the user or user avatar does not exist or cannot be found.
application/jsonClient error

An unexpected client error.

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

Request Example

cURL
curl -i -X DELETE -L "https://api.box.net/2.0/users/12345/avatar" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.avatars.deleteUserAvatar(user.id);
Python Gen
client.avatars.delete_user_avatar(user.id)
.NET Gen
await client.Avatars.DeleteUserAvatarAsync(userId: user.Id);
Swift Gen (Beta)
try await client.avatars.deleteUserAvatar(userId: user.id)
Java
String userID = "33333";
BoxUser user = new BoxUser(api, userID);
user.deleteAvatar();
Python
client.user('33333').delete_avatar()
.NET
bool isDeleted = await client.UsersManager.DeleteUserAvatarAsync(userId);
Node
client.users.deleteAvatar('22222', () => {
    console.log('User avatar deleted!'); 
});
iOS
client.users.deleteAvatar(userId: "33333") { result in
    guard case .success = result else {
        print("Error deleting avatar")
        return
    }

    print("Avatar successfully deleted")
}