PATCH /auth/user/me/avatar

Updates the profile avatar of the currently authenticated user. Accepts image file upload.

multipart/form-data

Body Required

  • avatar string(binary) Required

    Avatar image file (JPG, PNG, GIF). Maximum size 5MB.

Responses

  • 200 application/json

    Avatar updated successfully

    Hide response attributes Show response attributes object
    • success boolean
    • code integer(int32)
    • message string
    • data object
      Hide data attribute Show data attribute object
      • avatarUrl string(uri)

        URL of the updated avatar image

  • 400 application/json

    Bad Request - Invalid file format or size

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 413 application/json

    Payload Too Large - File size exceeds limit

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
PATCH /auth/user/me/avatar
curl \
 --request PATCH 'https://api.huy-devops.site/api/auth/user/me/avatar' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: multipart/form-data" \
 --form "avatar=@file"
Response examples (200)
{
  "success": true,
  "code": 200,
  "message": "string",
  "data": {
    "avatarUrl": "https://cdn.example.com/avatars/user_12345.jpg"
  }
}
Response examples (400)
{
  "success": false,
  "code": 42,
  "errorCode": "INVALID_AVATAR_FILE",
  "message": "Avatar must be a valid image file (JPG, PNG, GIF) and less than 5MB",
  "timestamp": "2025-05-04T09:42:00Z"
}
Response examples (413)
{
  "success": false,
  "code": 42,
  "errorCode": "FILE_TOO_LARGE",
  "message": "Avatar file size must not exceed 5MB",
  "timestamp": "2025-05-04T09:42:00Z"
}
Response examples (500)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2025-05-04T09:42:00Z"
}