Set User Avatar

Post
/api/v1/users.setAvatar

Permission required: edit-other-user-avatar, if the AllowUserAvatarChange setting under Accounts is enabled.

Changelog

Version Description
0.56.0 Add support for username argument.
0.48.0 Set other users avatars if the callee has permission.
0.46.0 Added
Header parameters
X-User-Id
stringRequired

The authenticated user ID.

ExamplerbAXPnMktTFbNpwtJ
X-Auth-Token
stringRequired

The authenticated user token.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
Body parameters

You have 2 options to set the user avatar:

  • Upload the image file to use as the new avatar, as form data. For example, [email protected].
  • Enter the image URL you want to set as the user avatar in the request body.
Example 1
{
  "avatarUrl": "http://domain.tld/to/my/own/avatar.jpg"
}
object
avatarUrl
string Required

Enter the image URL you want to set as the user avatar.

Examplehttp://domain.tld/to/my/own/avatar.jpg
userId
string

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.

Responses
200

OK

Success
{
  "success": true
}
object
success
boolean
400

Bad Request

Example 1
{
  "success": false,
  "error": "Missing Content-Type"
}
object
success
boolean
error
string
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string