Auth0 Home Blog Docs

Management API replace app metadata instead of merge

management-api
metadata
user-metadata

#1

I need to replace my app meta data (I store permissions there) instead of just merging them. Whats the best way to achieve that?


#2

A quick test showed that a PATCH request to https://{{tenant}}.auth0.com/api/v2/users/{{id}} with a body of { "app_metadata": null } removed the existing app_metadata of a user.


#3

So I have to do first a patch request with null and than my body? Thanks for your help! I think a PUT request would be very nice to have!


#4

Yes, I could have been more complete in my initial answer; if you want to completely replace the metadata and you don’t know the exact set of properties that already exist then doing the two-step approach would be an option.


#5

Thanks very much for your help!


#6