Use this endpoint to change your or another user's avatar. You can change avatars only if the AllowUserAvatarChange setting under Accounts is enabled. To change another user's avatar, you need the permission: edit-other-user-avatar.
Changelog
| Version | Description |
|---|---|
| 8.7.0 | Added optional service multipart field (stored as avatarOrigin) |
| 0.56.0 | Add support for username argument. |
| 0.48.0 | Set other users avatars if the callee has permission. |
| 0.46.0 | Added |
The authenticated user ID.
The authenticated user token.
You have two options to set the user avatar:
- Upload the image file to use as the new avatar, as form-data. For example,
image=@my-own-avatar.png. Optionally include aservicefield to record which OAuth/external service the avatar came from (stored asavatarOrigin). - Enter the image URL you want to set as the user avatar in the request body, using the parameter
avatarUrl.
{
"avatarUrl": "http://domain.tld/to/my/own/avatar.jpg"
}Enter the image URL you want to set as the user avatar.
The ID or username of the user. If not provided, the avatar of the user who is sending the request is updated. Alternatively, you can enter the username parameter.
{
"image": "QG15LW93bi1hdmF0YXIucG5n",
"service": "google"
}The image file to upload as the new avatar.
Optional. The name of the OAuth/external service the avatar originates from (e.g. google, facebook, gravatar). Stored as avatarOrigin.
The ID or username of the user. If not provided, the avatar of the user who is sending the request is updated.
OK
{
"success": true
}Bad Request
{
"success": false,
"error": "Missing Content-Type"
}Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}