Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

bulk delete for unsynced users

Starting from Confluence 6.13, admins can delete users that are unsynced from Confluence. Unsynced users are users that are not synced any more when an external user directory is being synchronized. This could be because the user has been removed from the external directory or it is because the user directory filters no longer include that user etc.

While this feature is useful, the current implementation only allows the deletion of these users individually and there is no option to perform bulk delete. Having the bulk delete feature would greatly help.

Does anyone have a set of scripts, which do such a bulk removing

There exists a feature request for that feature and it requires more voting for.

Best regards,


2 answers

Had to deal with that just right now on our instances - after giving the list (max out the pagesize to 100) a rough scan if I am sure they should be deleted and then opened the Java Script console to run the following Javascript

AJS.$('#user-search #browse-user-table a:not(.confluence-userlink)').each(
function (ie) {var id = $(e).attr('href').split('=')[1];    
userKey: id'atl_token': AJS.Meta.get('atl-token') }, 
function () {'Deleted ' + id) })

This uses the HTML DOM on the page to select the userKeys and makes AJAX posts to remove the users. Instead of having to click 900 times for 300 users and wait for 600 page loads I just refresh the page 3 times and run the script 3 times and all the users are deleted.

A word of warning though: these users never authored anything in Confluence and deleting them is very simple. That might be different for your environment.

Still you can reduce the page size to fine tune or change the script to wait for completion (then you would need to track progress) or simply add a delay.

Hello Christoffer,

if i understand Your posting correct, Your script will NOT

  • permanently replace their username with a randomised alias, wherever it appears.

or what do You mean with

"these users never authored anything Confluence"

Best regards from just around the corner in Schloßstraße,


Well, see above answer - the community software is doing strange things ...

Thank you for your javascript. Worked perfectly. 

Hi Christoffer

I try use your script, but see error: batch.js?healthcheck-resources=true&hostenabled=true&locale=en-GB:392 POST http://ip_addr/admin/users/removeunsynceduser-confirm.action 404 (Not Found)

Why? =(

Used successfully the javascript incantation above to clean up unsynced users after breaking application link to JIRA service desk and then removing the user directory link.

Works well, 100 users at a time.

Works like a charm! Many THX!

0 votes
Diego Atlassian Team Feb 07, 2019

Hello there Lutz! Is this the Suggestion that you mentioned:

CONFSERVER-57857 | Provide the functionality to perform bulk delete for unsynced users

The user deletion process can be quite taxing for your instance. As of today, there is no built-in feature or Atlassian Made script that takes care of start the deletion processes automatically. Each deletion process should be started individually and will only start after the previous one has ended.

However, there are some plugins that claim being capable of bulk user deletion, such as:

User Management for Confluence

Further, you could vote and watch this suggestion. Voting increases the visibility of this report and watching will keep you up to date with anything new there.

Let us know your thoughts Lutz!

Hello Diego,

Yes that is the suggestion. If You have around 1500 Students per Year, who are unsynced, You don't want to remove them manually.

The Plugin You mentioned does not work on unsynced users.

Do You know a plugin, which do so.

I have voted already.

Best regards, Lutz

Hi Lutz,

the world is small. I meant that for me and my instance this operation is pretty light-weight, because the selects/deletes the database has to perform will not find anything to change (other than the user record itself). I did not see any performance hits that Diego mentioned, if your users did in fact create spaces, author pages, upload attachments etc. that might have a bigger impact (and your instance might also be much bigger).

For me the script running with a page size of 50 worked fine without causing any problems. The code that is run on the server is the same as if you click through every single user - the script is just triggering that code without all the clicking and waiting ...

I guess copying to Custom HTML <end of body section> and keep running multiple times until users deleted?


is this way to run the java script?

No, open the Developer Console of your browser when on the Unsynced Users page. Don't put that in Custom HTML of your Confluence instance, this will swamp the browser console and possibly even break pages from rendering correctly.

Like ViswanathanR likes this

Cool, thanks Christoffer.

May be helpful, the script works, but I get warning too


DEPRECATED JS - Dialog has been deprecated since 6.0.6 and will be removed in a future release. Use require('confluence-create-content/space-blueprint')
at HTMLDocument.<anonymous> (https://<MyconfluenceURL>/_/download/contextbatch/js/_super/batch.js?locale=en-GB:860:136)


I'm on 6.13 version and planning to upgrade. 

Hi Viswanathan,

this is not from the script - but from Confluence UI packages that run when you visit a page, it means that either a third-party app vendor or the Atlassian team is using a JS component (Dialog) that has been marked as deprecated by the maintainer (Atlassian).
This is nothing that you have to worry about, but the Atlassian Confluence team and app vendors need to take care of that. Cheers, Chris

Cool thanks for the response.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

504 views 18 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you