User metadata
Create user metadata
To create a user with the following profile details:POST
call to the /post_users
endpoint to create the user and set the property values:
Update user metadata
You can update a user’s metadata by making aPATCH
call to the Management API /patch_users_by_id
endpoint.
Assuming you created a user with the following metadata values:
user_metadata
and add the user’s home address as a second-level property:
PATCH
call:
When you send a
PATCH
call in which you have set a property’s value to null
(for example, {user_metadata: {color: null}}
), Auth0 deletes the property/value from the database. Also, patching the metadata itself with an empty object removes the metadata completely.Merge user 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 theaddresses
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:
Delete user metadata
You can deleteuser_metadata
:
App metadata
Patching the metadata with an empty object removes the metadata completely. For example, sending this body removes everything inapp_metadata
:
Client metadata
Create applications with client metadata
AclientMetadata
object can be included when creating a new application via the POST /api/v2/
applications endpoint.
Read client metadata
Client metadata is included in the response to theGET /api/v2/clients
and GET /api/v2/client/{id}
endpoints.
Update client metadata
Client metadata can be updated using thePATCH /api/v2/clients/{id}
endpoint, supplying an application object with the clientMetadata property
, which has a value that consists of an object containing the metadata you’d like to change.
Application before:
PATCH /api/v2/client/myclientid123
with body:
Delete client metadata properties and values
Client metadata keys can be removed by issuing a PATCH, as described in “Update app_metadata” above, but supplyingnull
for the key value. This behavior matches that of the user_metadata
and app_metadata
properties in the PATCH
/api/v2/users/ endpoint.