Skip to main content
PATCH
/
api
/
v1
/
auth
/
me
Update current user profile
curl --request PATCH \
  --url https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/auth/me \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "fullName": "<string>",
  "preferences": {
    "language": "<string>",
    "theme": "<string>",
    "notifications": true
  },
  "_clearAvatar": true
}
'
{
  "success": true,
  "data": {
    "user": {
      "id": "<string>",
      "fullName": "<string>",
      "accountStatus": "active",
      "createdAt": "2023-11-07T05:31:56Z",
      "email": "jsmith@example.com",
      "phoneNumber": "<string>",
      "avatarUrl": "<string>",
      "authProvider": "<string>",
      "preferences": {
        "language": "<string>",
        "theme": "<string>",
        "notifications": true
      },
      "deviceId": "<string>",
      "platform": "android",
      "phoneVerified": true,
      "emailVerified": true,
      "last_login_at": "2023-11-07T05:31:56Z"
    },
    "usage": {
      "conversations": {
        "total": 123,
        "active": 123,
        "archived": 123,
        "deleted": 123,
        "lastActiveAt": "2023-11-07T05:31:56Z"
      },
      "shares": {
        "total": 123,
        "active": 123,
        "expired": 123,
        "revoked": 123,
        "totalViews": 123,
        "lastSharedAt": "2023-11-07T05:31:56Z"
      }
    },
    "profileContext": {
      "static": [
        "<string>"
      ],
      "recent": [
        "<string>"
      ],
      "frequent": [
        "<string>"
      ]
    }
  },
  "meta": {
    "timestamp": "2023-11-07T05:31:56Z",
    "requestId": "<string>"
  }
}
Updates the authenticated user’s profile including avatar upload. Requires a valid Auth0 access token in the Authorization header. This endpoint supports both JSON and multipart/form-data content types:
  • JSON: For updating profile fields only
  • multipart/form-data: For uploading an avatar image along with profile updates

Request Body (JSON)

All fields are optional. Only include the fields you want to update.
FieldTypeDescription
fullNamestringUser’s display name (1-120 chars, trimmed)
preferencesobjectUI preferences (merged with existing)
preferences.languagestringLanguage code (e.g., “en”, “hi”)
preferences.themestringTheme name (e.g., “dark”, “light”)
preferences.notificationsbooleanEnable/disable notifications
_clearAvatarbooleanSet to true to remove the current avatar

Request Body (multipart/form-data)

For uploading an avatar image:
FieldTypeDescription
avatarfileAvatar image file (JPEG, PNG, GIF, WebP). Auto-compressed if >1MB.
datastringJSON string with profile fields (fullName, preferences, _clearAvatar)

Example: JSON Request

curl -X PATCH https://api.handauncle.com/api/v1/auth/me \
  -H "Authorization: Bearer <access-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "fullName": "Puneet Sharma",
    "preferences": {
      "theme": "dark",
      "notifications": true
    }
  }'

Example: Upload Avatar

curl -X PATCH https://api.handauncle.com/api/v1/auth/me \
  -H "Authorization: Bearer <access-token>" \
  -F "avatar=@/path/to/photo.jpg" \
  -F 'data={"fullName": "Puneet Sharma"}'

Example: Clear Avatar

curl -X PATCH https://api.handauncle.com/api/v1/auth/me \
  -H "Authorization: Bearer <access-token>" \
  -H "Content-Type: application/json" \
  -d '{"_clearAvatar": true}'

Response

Returns the updated profile overview (same format as GET /api/v1/auth/me):
{
  "success": true,
  "data": {
    "user": {
      "id": "683b7e9f465b1b4e6753627a4f",
      "email": "investor@example.com",
      "fullName": "Puneet Sharma",
      "avatarUrl": "https://storage.googleapis.com/...",
      "preferences": {
        "language": "en",
        "theme": "dark",
        "notifications": true
      }
    },
    "usage": { ... },
    "profileContext": { ... }
  }
}

Avatar Upload Details

  • Supported formats: JPEG, PNG, GIF, WebP
  • Auto-compression: Images larger than 1MB are automatically resized (max 800px) and compressed
  • No size limit error: Even large files are accepted and compressed server-side
  • Auto-deletion: Previous avatar is automatically deleted when uploading a new one

Notes

  • Field merging: Preferences are merged with existing values, not replaced entirely
  • Whitespace trimming: fullName is automatically trimmed
  • Cache invalidation: The profile context cache is invalidated when changes are saved

Authorizations

Authorization
string
header
required

Auth0 access token for registered users.

Body

Profile update fields. Use _clearAvatar: true to remove avatar, or upload avatar file via multipart/form-data.

fullName
string

User's display name

Maximum string length: 120
preferences
object

User preferences

_clearAvatar
boolean

Set to true to remove the user's avatar

Response

Updated profile overview returned

success
enum<boolean>
required
Available options:
true
data
object
required
meta
object
required