# Push data to user metadata from API

**URL:** <https://community.auth0.com/t/push-data-to-user-metadata-from-api/90035>\
**Category:** Get Help\
**Tags:** user\_metadata\
**Created:** [September 5, 2022, 10:11pm UTC](https://community.auth0.com/t/push-data-to-user-metadata-from-api/90035 "2022-09-05T22:11:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tettemerd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tettemerd/32/12714_2.png) [@tettemerd](https://community.auth0.com/u/tettemerd)\
**Post date:** [September 5, 2022, 10:11pm UTC](https://community.auth0.com/t/push-data-to-user-metadata-from-api/90035/1 "2022-09-05T22:11:25Z")

</div>

Hey everyone! I am trying to push data into a new array under all of my users so when they order an item my api gets the users metadata then pushes that order to the array under their profile. However, when i tried using the patch request it only replaced the item instead of creating an array. Is there something specific I can do when it comes to calling the management API to push data into an array?

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [September 6, 2022, 6:02pm UTC](https://community.auth0.com/t/push-data-to-user-metadata-from-api/90035/3 "2022-09-06T18:02:28Z")

</div>

Welcome to the Auth0 Community!

As explained in [this](https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id) doc,

`The metadata fields are an exception to this rule (`user\_metadata`and`app\_metadata`). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level.`

For your use case, you want to append an item to an array under an attribute in the user\_metadata, this is not adding a new attribute under the user\_metadata, therefore, the value saved in the attribute got replaced instead of merged.

To add a new item to the array object, let’s say adding` "2"` to `"arr": ["1"]` under user\_metadata, please use this:

```auto
{
"user_metadata":{
 "arr": ["1","2"]
}
}

```

Hope this helps!

---

<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:** [December 21, 2022, 6:09pm UTC](https://community.auth0.com/t/push-data-to-user-metadata-from-api/90035/4 "2022-12-21T18:09:20Z")

</div>


