Skip to main content

updateUserProfileImage()

Updates the profile image for the given user. To remove the profile image, see deleteUserProfileImage().

Returns the updated User.

function updateUserProfileImage(userId: string, params: { file: Blob | File }): Promise<User>
  • Name
    userId
    Type
    string
    Description

    The ID of the user to update the profile image for.

  • Name
    params
    Type
    { file: Blob | File; }
    Description

    The file to set as the user's profile image.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

Warning

Using clerkClient methods can contribute towards rate limiting. To set a user's profile image, it's recommended to use the frontend user.setProfileImage() method instead.

const userId = 'user_123'
const fileBits = ['profile-pic-content']
const fileName = 'profile-pic.png'
const file = new File(fileBits, fileName, { type: 'image/png' })

const params = {
  file,
}

const response = await clerkClient.users.updateUserProfileImage(userId, params)

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/users/{user_id}/profile_image. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on