# How to update user metadata

**URL:** <https://community.auth0.com/t/how-to-update-user-metadata/98680>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [January 23, 2023, 5:01am UTC](https://community.auth0.com/t/how-to-update-user-metadata/98680 "2023-01-23T05:01:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darrin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/darrin/32/42901_2.png) [@Darrin](https://community.auth0.com/u/Darrin)\
**Post date:** [January 23, 2023, 5:01am UTC](https://community.auth0.com/t/how-to-update-user-metadata/98680/1 "2023-01-23T05:01:05Z")

</div>

I am practicing/testing on the management api. I am connecting and are getting a userInfo object just fine but am having trouble updating some user meta data.  
This is the code I am using.  
UserMetaData metaData = new UserMetaData();  
metaData.NeedsToAcceptTerms = false;

```
        var response = await apiClient.Users.UpdateAsync(userId, new Auth0.ManagementApi.Models.UserUpdateRequest
        {
            UserMetadata = JsonConvert.SerializeObject(metaData)
        });

```

And I get this error thrown.  
Message : Payload validation error: ‘Expected type object,null but found type string’ on property user\_metadata (User metadata to which this user has read/write access).

Can anyone direct me to what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![Darrin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/darrin/32/42901_2.png) [@Darrin](https://community.auth0.com/u/Darrin)\
**Post date:** [January 24, 2023, 3:59am UTC](https://community.auth0.com/t/how-to-update-user-metadata/98680/2 "2023-01-24T03:59:42Z")

</div>

I solved this - I didn’t need to convert the object to a JSON string it should just  
UserMetadata = metaData

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 26, 2023, 11:27am UTC](https://community.auth0.com/t/how-to-update-user-metadata/98680/3 "2023-01-26T11:27:24Z")

</div>

Glad that you figured it out and thanks for sharing with the rest of community!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 9, 2023, 11:28am UTC](https://community.auth0.com/t/how-to-update-user-metadata/98680/4 "2023-02-09T11:28:17Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
