What is the significance of "blocked" parameter in PATCH /api/v2/users/{id} call?

I have a requirement where I want to deactivate the user based on certain criteria. First I thought of deleting the user DELETE user and create it back if needed.

While going through docs, I found PATCH /user call with blocked option. If I set this to true and call GET /user API then I get the response with "blocked":true whereas if I call DELETE /user endpoint, I get user does not exists (something like that) response.

I guess, I am not sure in what case I should use PATCH call with blocked: true.

Hi @gunjan.prmr ,

Thank you for posting this topic on the Auth0 Community!

To deactivate the users, we can block users to revoke their access to the Application. If deleting the users instead, they could try signing up again to get access to the Application.

I did the following test and here are the details.

  1. called the [PATCH user by id] with the below body scripts (Auth0 Management API v2) endpoint
{
  "blocked": true
}
  1. verified that the user is blocked on the Auth0 Dashboard.
  2. called the Get a User endpoint, the user exists with "blocked": true.
  3. called the Delete a User endpoint
  4. verified that the user does not exist on the Auth0 Dashboard since it’s been deleted.

If you have followed the same steps and observed different responses, could you provide additional context? I am happy to look into this further.

Thank you!

I observed the same results. My question was more of a like “what is right path for my use case”. I want to deactivate the user based on some criteria, then should I call PATCH call with “blocked:true” or just delete the user.

I guess you are confirming that user shows blocked in Auth0 dashboard. Meaning, the user won;t be able to sign in, in this case. If true, then I will go with PATCH.

I suggest you use the patch call to block the users if you want to deactivate them :slightly_smiling_face:

This topic was automatically closed after 13 days. New replies are no longer allowed.