REST API Call to Disable User?


I am trying to disable a user via the Bitbucket Data Center v7.21.0 REST API.
I have successfully figured out how to accomplish this task in Jira and Confluence (using the REST Extender).
I have looked through the Bitbucket REST API documentation, and searched the web.
Solved: API to Delete user from Repository seems to point to the ability to disable the user via a PUT to “admin/users”, but I am getting this error when attempting that:

Unrecognized field "active" (Class, not marked as ignorable
 at [Source: com.atlassian.stash.internal.web.util.web.CountingServletInputStream@5368d0c6; line: 1, column: 16] (through reference chain:["active"])

Is the field to disable a user named something other than active ?
Is there another endpoint I should be using?

Thanks in advance - any help is appreciated.

Hi Todd,

Just to help make sure the information is listed here too:

If you’re looking to effectively ‘disable’ a user that is stored within the internal user directory in Bitbucket Data Center, the only thing you need to do is remove any global permissions that have been assigned to their user, or remove them from any groups that have global permissions assigned to them in Bitbucket. Users with no global permissions are unable to access Bitbucket and are not counted as licensed users. And to “re-enable” these users, you would just need to add the global permission back to their user.

This means you’d ultimately end up making calls to either this REST API endpoint for removing users from groups, or this endpoint for removing any global permission assigned directly to the user (depending on how your permissions are set up):

  • POST to this endpoint for removing users from groups:
    • /rest/api/1.0/admin/users/remove-group
    • Example POST request body:
    "context": "username",
    "itemName": "groupname"
  • DELETE to the following endpoint to revoke all global permissions directly assigned to user:
    • /rest/api/1.0/admin/permissions/users?name

Hope this helps!

Evan Slaughter
Senior Support Engineer, Development Tools

Evan -

Thanks for the detailed response. I have coded up a solution based on your post, and will be testing it soon.


Excellent! If you have any other questions on this front, or if anything comes up as a result of your testing, don’t hesitate to let us know. :+1: