Skip to main content
You can access and set user_metadata and app_metadata in user profiles using a variety of methods depending on your use case.
When you create a new user with the Management API’s Create a User endpoint (POST /users), you can set the new user’s metadata by specifying the body parameters for user_metadata and app_metadata.
To create a user with the following profile details:
Make the following POST call to the /post_users endpoint to create the user and set the property values:
Using the Auth0 CLI? If you haven’t already, set up and authenticate your CLI session before running this command.
You can set or update an existing user’s metadata with the Update a User endpoint (PATCH /users/{id}) by similarly specifying the body parameters for user_metadata and app_metadta.
Assuming you created a user with the following metadata values:
To update user_metadata and add the user’s home address as a second-level property:
You would make the following PATCH call:The user’s profile will now appear as follows:
When you update an existing user’s metadata, only properties at the root level are merged into the object. All lower-level properties will be replaced.
For example, to add a user’s work address as an additional inner property, you would have to include the complete contents of the addresses property. Since the addresses object is a root-level property, it will be merged into the final JSON object representing the user, but its sub-properties will not.
Therefore, the corresponding PATCH call to the API would be:
To delete a metadata key, make a PATCH call and set the metadata key’s value to null (for example, { "user_metadata": {"color": null}}).To delete user or app metadata entirely, make a PATCH call and set the metadata itself to an empty object (for example, { "user_metadata": {} }).