Upload a profile image for the current authenticated user. The image is validated, resized to 256x256 pixels if larger, re-encoded as PNG, and stored in the database. The avatar URL is automatically synced to the user's Logto profile.
PUT
/me/avatar
curl \
--request PUT 'https://api.your-domain.com/api/me/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 (500)
{
"code": 500,
"message": "internal server error",
"data": {}
}