Upload a profile image for another user. Requires manage:users permission and hierarchical access to the target user. Self-modification is prevented (use PUT /me/avatar instead). The image is validated, resized to 256x256 pixels if larger, re-encoded as PNG, and stored in the database.
PUT
/users/{id}/avatar
curl \
--request PUT 'https://api.your-domain.com/api/users/jf584cz36kce/avatar' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: multipart/form-data" \
--form "avatar=@file"
Response examples (200)
{
"code": 200,
"message": "avatar uploaded successfully",
"data": {
"avatar_url": "https://my.nethesis.it/api/public/avatars/jf584cz36kce"
}
}
Response examples (400)
{
"code": 400,
"message": "validation failed",
"data": {
"type": "validation_error",
"errors": [
{
"key": "username",
"message": "required",
"value": "string"
}
]
}
}
Response examples (401)
{
"code": 401,
"message": "invalid token",
"data": {}
}
Response examples (403)
{
"code": 403,
"message": "insufficient permissions",
"data": {}
}
Response examples (404)
{
"code": 400,
"message": "validation failed",
"data": {
"type": "validation_error",
"errors": [
{
"key": "username",
"message": "required",
"value": "string"
}
]
}
}
Response examples (500)
{
"code": 500,
"message": "internal server error",
"data": {}
}