user_metadata and app_metadata in user profiles using a variety of methods depending on your use case.
- Management API
post-loginAction- Lock
- Rules
When you create a new user with the Management API’s Create a User endpoint (
You can set or update an existing user’s metadata with the Update a User endpoint (
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.
To delete a metadata key, make a
POST /users), you can set the new user’s metadata by specifying the body parameters for user_metadata and app_metadata.Example: create new user with metadata
Example: create new user with 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.
PATCH /users/{id}) by similarly specifying the body parameters for user_metadata and app_metadta.Example: update an existing user's metadata
Example: update an existing user's metadata
Assuming you created a user with the following metadata values:To update You would make the following
user_metadata and add the user’s home address as a second-level property:PATCH call:The user’s profile will now appear as follows:Example: update metadata sub-properties
Example: update metadata sub-properties
For example, to add a user’s work address as an additional inner property, you would have to include the complete contents of the Therefore, the corresponding
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.PATCH call to the API would be: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": {} }).