Box Developer Documentation
Latest version

Get user avatar

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

Retrieves an image of a the user's avatar.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The ID of the user.

Response

image/jpg

When an avatar can be found for the user the image data will be returned in the body of the response.

application/jsonClient error

An unexpected client error.

get
Get 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 GET "https://api.box.com/2.0/users/12345/avatar" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.avatars.getUserAvatar(user.id);
Python Gen
client.avatars.get_user_avatar(user.id)
.NET Gen
await client.Avatars.GetUserAvatarAsync(userId: user.Id);
Java
String userID = "33333";
// some stream do download avatar
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()){
  BoxUser user=new BoxUser(api,userID);
  user.downloadAvatar(outputStream);
} catch (IOException e) {
  throw new RuntimeException(e);
}
Python
avatar = client.user('33333').get_avatar()
.NET
Stream imageStream = await client.UsersManager.GetUserAvatar(string userId);
Node
client.users.getAvatar('22222')
    .then(avatarImageStream => {

        avatarImageStream.on('data', bytes => {
            // read avatar image bytes
        });
    });
iOS
client.users.getAvatar(userId: "33333") { (result: Result<Data, BoxSDKError>) in
    guard case let .success(avatarData) = result else {
        print("Error getting user avatar")
        return
    }

    let avatarImage = UIImage(data: avatarData)
}