Auth0 Home Blog Docs

Can we delete a spefici fields from user profile at auth0?

Is it possible to delete a specific fields from auth0 profile. I have done updating new fields but unable to fine how to delete/remove a fields from profile.

Hey there!

As far as I remember you need to use appropriate API endpoint (PUT) and set the field to null to delete it

@konrad.sopala has it right:

1 Like

That will simply make the field null but i want to remove that key/value pair from profile.

It’s a bit clunkier but you could save the current metadata, patch with "app_metadata": {} or "user_metadata": {}, then patch the saved metadata with your mods.

I don’t need to patch anything. All i need to remove one fields from user_metadata.

Sorry, by “patch” I just meaning calling the users endpoint to update their profile data. As you noted, passing an empty object for a given attribute does not remove the attribute itself, it just sets the attribute to the empty object. To “remove” the attribute completely you’ll need to pass the empty object ({}) to the attribute one level higher in the profile structure, but you want to save the data first so you can write the correct data back.

  1. Save user_metadata locally,
  2. Modify your local copy of user_metadata,
  3. Clear user_metadata by passing { "user_metadata": {} } to the users endpoint,
  4. Write you local copy of user_metadata back to the user profile via the users endpoint.

Its not possible because i have arounf 3 million live user at Auth0 system. It won’t be possible to fetch all users first then update those users. It will take infinite time tocomplete.

Understood. As far as I know there’s no way at this time to apply a bulk change in a way that would be convenient. I’d suggest leaving a feature request at https://auth0.com/feedback.

If you user community is very active (high MUA to total user ratio) you could put the above logic into a rule and let the change take place over time, then clean up the stragglers which limits the bulk changes you need to make.

If you user community is less active (low MUA : total user ratio) then the only option is leveraging the API and some scripting to work through you user base. Obviously not ideal but not impossible: with ~3 million users that’s a script running for about 60 hours (/users endpoint rate limit is 15rps in production).

1 Like

Thanks for help. Appreciated

We’re here for you @rashid779939!

1 Like