Skip to main content
Update the authenticated user’s profile (display name, description, avatar, and custom metadata) using editUser() on iOS/Android or UserRepository.updateUser() on TypeScript. Only the current user can update their own profile. Image Upload: Before setting an avatar, you must first upload the image file. Refer to the Image Upload guide for detailed instructions.
User Authorization: Only the currently authenticated user can update their own profile information. Administrators may have additional privileges through the Console.
// Build the current user data
let options = AmityUserUpdateOptions()
options.setDisplayName("Batman")
options.setUserDescription("Hero that Gotham needs")
options.setAvatar(nil)

// Add custom metadata
let metadata: [String: Any] = ["role": "superhero", "city": "Gotham"]
options.setUserMetadata(metadata)

// Update the current user from the options
do {
    try await client.editUser(options)
    print("User updated successfully")
} catch {
    print("Update failed: \(error.localizedDescription)")
}

Best Practices

Performance Optimization

Batch Updates: When updating multiple user properties, combine them into a single update operation instead of making separate calls for better performance.
Rate Limiting: Be mindful of update frequency to avoid hitting rate limits. Consider implementing debouncing for real-time input fields.

Next Steps

Get User Information

Learn how to retrieve updated user profiles

User Permissions

Understand user roles and permissions