Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to get confluence licensed users count from database

I am new to confluence. I just would like know how to get confluence licensed users count. Currently, our organisation has limit of 10000  users. And in this 4935 signed up users. I mean 4935 used. But when trying get count for licensed users from data base using following query I got only 2932. I am not understanding why both displaying different. Please let me whether I am using correct query or not getting licensed users count for confluence.


SELECT count(
cwd_user users
cwd_directory userdir
users.lower_user_name IN
OR users.lower_user_name IN
cwd_user u
cwd_directory d
u.directory_id =
cwd_membership m
ON = m.child_user_id
cwd_group g
ON = parent_id
g.lower_group_name =lower(sp.permgroupname)
permtype='USECONFLUENCE' )

2 answers

1 vote

Don't bother with the database, it's complex and you're looking at the wrong thing anyway.

Go to Admin -> Global permissions and get the list of groups that have "can use" in there.  The members of those groups are the ones that give you  the 4953 (note, that deduplicates users - if you're in three of the groups for example, you only count once to the 4953)

Thank you for response. But, I have different situation like I need to read the list of licensed users from data base.  So, I google it and tried with multiple queries but mostly the results are getting below 3000. But, when I verify the count in Confluence Admin page it has 4900+ used licenses.


May be you are right, one user can have multiple licenses. because of that count is varying. But, I need total licenses used count using script. I don't have knowledge how to get that.

"I need to read from the database" does not explain what you are trying to do.  It is almost certainly the wrong way to do it.

Instead of running off down the path of a probably complex and inaccurate solution, could you explain what you are trying to achieve instead?

Your original question was "I want to get the number of licenced users" and you then said you had 4935.  Assuming that is from the Confluence system information, licence or user list pages, then it is already the answer.  Why are you trying to replicate it using another method?

I am trying to create a console job to get the count of licensed users and need to notify the admins if count crossed certain limit. For that, I am trying to fetch the signed up users count and verifying count is crossed or not in console. But, my problem is I am unable fetch actual count  that displayed in the admin page. Please let me know if you have other ways to read the count if it is not possible from database.

I am still not understanding why reading from database is not right way.

The database is not right because you are asking it the wrong question.  Because it's messy and can't tell you the right answer unless you completely understand it.

Best way to do this would be to note what group(s) let you into Confluence (they rarely change once set up) and then get the list of users in those groups over the REST API 

Suggest an answer

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

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

202 views 1 6
Read article

Atlassian Community Events