> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Update User Information

> Update the current user's display name, description, avatar, and metadata with social.plus SDK.

Use the user update APIs when the signed-in user changes their social profile. Client SDKs update the current user's profile fields; privileged edits to other users should be handled through admin or backend workflows.

Before setting an avatar file, upload the image first. See [Image Handling](/social-plus-sdk/core-concepts/content-handling/files-images-and-videos/image-handling#image-upload) for the upload flow.

<Info>
  Only update fields that changed. The SDK update builders and patch objects let you send partial profile updates.
</Info>

## Parameters

| Field                            | Required               | Platforms                         | Description                                                                               |
| -------------------------------- | ---------------------- | --------------------------------- | ----------------------------------------------------------------------------------------- |
| `userId`                         | TypeScript and Flutter | TypeScript, Flutter               | User ID for the profile being updated. Use the current user's ID for client-side updates. |
| `displayName`                    | No                     | TypeScript, iOS, Android, Flutter | User-facing profile name.                                                                 |
| `description`                    | No                     | TypeScript, iOS, Android, Flutter | User-facing profile description or bio.                                                   |
| `avatarFileId` / uploaded avatar | No                     | TypeScript, iOS, Android, Flutter | Uploaded image reference used as the user's avatar.                                       |
| `avatarCustomUrl`                | No                     | TypeScript, iOS, Android, Flutter | Custom avatar URL where supported.                                                        |
| `metadata`                       | No                     | TypeScript, iOS, Android, Flutter | Custom social metadata. Do not store sensitive personal data here.                        |

## Update the current user's profile

Call the platform update method with only the fields you want to change.

### Inputs

| Platform   | Method                                                            | Required inputs                     | Optional inputs                                                                      | Result shape                                 |
| ---------- | ----------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------- |
| TypeScript | `UserRepository.updateUser(userId, patch)`                        | `userId`, patch object              | `displayName`, `description`, `avatarFileId`, `avatarCustomUrl`, `metadata`          | Returns `Promise<Amity.Cached<Amity.User>>`. |
| iOS        | `client.editUser(options)`                                        | `AmityUserUpdateOptions`            | Display name, description, avatar, avatar custom URL, metadata                       | Async call that throws on failure.           |
| Android    | `AmityCoreClient.editUser().build().apply()`                      | None beyond the active user session | `displayName`, `description`, `avatar`, `avatarCustomUrl`, `metadata`                | Returns `Single<AmityUser>`.                 |
| Flutter    | `AmityCoreClient.newUserRepository().updateUser(userId).update()` | `userId`                            | `displayName`, `description`, `avatarFileId`, `avatarCustomUrl`, `metadata`, `roles` | Returns `Future<AmityUser>`.                 |

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { UserRepository } from '@amityco/ts-sdk';

  async function updateUserProfile(userId: string) {
    const { data: user } = await UserRepository.updateUser(userId, {
      displayName: 'Batman',
      description: 'Hero that Gotham needs',
      metadata: {
        city: 'Gotham',
      },
    });

    console.log('Updated user:', user.displayName);
  }
  ```

  ```swift iOS theme={null}
  func updateUserProfile() async {
      let options = AmityUserUpdateOptions()
      options.setDisplayName("Batman")
      options.setUserDescription("Hero that Gotham needs")
      options.setUserMetadata(["city": "Gotham"])

      do {
          try await client.editUser(options)
          print("User updated")
      } catch {
          print("Update failed: \(error)")
      }
  }
  ```

  ```kotlin Android theme={null}
  fun updateUserProfile() {
      AmityCoreClient.editUser()
          .displayName(displayName = "Batman")
          .description(description = "Hero that Gotham needs")
          .metadata(metadata = JsonObject().apply {
              addProperty("city", "Gotham")
          })
          .build()
          .apply()
          .doOnSuccess { user: AmityUser ->
              Log.d("UserUpdate", "Updated user: ${user.getDisplayName()}")
          }
          .doOnError { error ->
              Log.e("UserUpdate", "Update failed", error)
          }
          .subscribe()
  }
  ```

  ```dart Flutter theme={null}
  Future<void> updateUserProfile(String userId) async {
    try {
      final user = await AmityCoreClient.newUserRepository()
          .updateUser(userId)
          .displayName('Batman')
          .description('Hero that Gotham needs')
          .metadata({'city': 'Gotham'})
          .update();

      print('Updated user: ${user.displayName}');
    } on AmityException catch (error) {
      print('Update failed: ${error.message}');
    }
  }
  ```
</CodeGroup>

## Platform notes

* iOS and Android update the active user through `client.editUser(...)` / `AmityCoreClient.editUser()`.
* TypeScript and Flutter take a `userId` in the update call. In client apps, pass the current user's ID.
* iOS `setAvatar(...)` expects uploaded `AmityImageData`; Android `avatar(...)` expects uploaded `AmityImage`; TypeScript and Flutter use avatar file IDs or custom URLs.
* Do not store sensitive personal data in `metadata`.

## Related topics

<CardGroup cols={2}>
  <Card title="Get User Information" href="./get-user-information" icon="user">
    Retrieve updated user profiles.
  </Card>

  <Card title="User Identity" href="../user-identity" icon="id-card">
    Choose stable user IDs and safe social profile fields.
  </Card>
</CardGroup>
