How to upload user avatar via GitLab API?

Hello. I try to add an avatar to a user when user updating but I don’t understand which format to use. I have try

  • base64 (raw and with mimetype)
  • direct link

Nothings seem to work.

Hey there,

I found that submitting an API request to the instance to change my avatar has also run into some issues. However, pushing this same request to my self managed instance is working fine.

Are you attempting to send this to, or a self managed instance? Would you be able to provide the exact method you are attempting to make the change, as well as any errors you are receiving?

Self managed instance.
“avatar is invalid”

Hey there,

Would you be able to provide the exact request you are submitting? The following curl request is a good baseline to reference.

curl --request PUT --header "PRIVATE-TOKEN: XXXXXXXXXXXXXXXX" --form "avatar=@/my_folder1/file.jpg" https://my_gitlab_host/gitlab/api/v4/users/:id

Also, please ensure that your avatar is under 200KiB, as that is the size limit. And be sure that the image is one of the following supported file types, as shown here.