How to get confluence licensed users count through rest API?
Asked by Anoop K Baby:

How to get confluence licensed users count through rest API?


Answers:
author: Frederik Bauer
body: Hey, I know this is an old question. However, I also just stumbled over that problem and the answer is now in the above linked ticket. To save some time for future users I just add the information here too:

This [comment](https://jira.atlassian.com/browse/CONFSERVER-37100?focusedCommentId=1742358&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1742358) mentions these (in Confluence 7.4.10 working) rest endpoints:

/rest/license/1.0/license/userCount  
/rest/license/1.0/license/remainingSeats  
/rest/license/1.0/license/maxUsers

Hope this will save some time for others. :)

comments: author: Tom Bell
body: That's awesome Frederik! I've been looking for a way to do this for a long while. Thanks!!

Tom


author: yebajod265
body: Hi Frederik,  
Have tried the above mentioned api in postman to get the licensed user count.  
There i'm getting the error:"No value present" in the response  

Is the domain url before the /rest/licence should be the atlassian company domain url. Is there any api link to check with. Or is there any change required in the api call.![Screenshot 2022-08-10 at 7.52.48 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/210457i4F33C240C2B1F4C7/image-size/large?v=v2&px=999 "Screenshot 2022-08-10 at 7.52.48 PM.png")


author: Frederik Bauer
body: Hey, sry for the late reply.

My answer was for the Server/Data Center version of Confluence. It seems that you are looking for a solution for the Cloud version of Confluence. For that I unfortunately can't help you.

Hope you will find or already found your answer somewhere else. :)


author: Krister Broman _Advania_
body: They work in cloud as well you just have to add the wiki part to the URLs so they are  

{{instance}}/wiki/rest/license/1.0/license/userCount  
{{instance}}/wiki/rest/license/1.0/license/remainingSeats  
{{instance}}/wiki//rest/license/1.0/license/maxUsers


author: Shannon S
body: Hi Anoop,

This is not yet possible, but we have a feature request for it:

* [CONFSERVER-37100](https://jira.atlassian.com/browse/CONFSERVER-37100)

It's possible to do using a database query:

* [How to get a list of active users counting towards the Confluence license](https://confluence.atlassian.com/confkb/how-to-get-a-list-of-active-users-counting-towards-the-confluence-license-298978076.html)

Let me know if you have any questions about this.

Regards,

Shannon

comments: author: Anoop K Baby
body: Hi Shannon,

I am just looking to get my purchased license count for an automation to avoid the hard coded value, not the list of active users counting, that I got already through the same thread you posted above.

Regards,

Anoop


author: Shannon S
body: Anoop,

Alright, thank you for letting me know you were able to obtain it via that method.

If you have any further questions please let us know.

Regards,

Shannon


author: Anoop K Baby
body: Hi Shannon,

No, I think you misunderstood my reply. Still I am not able to figure out a way for my actual request. Again for a clarity, I was looking for an option to find the count of my purchased license through an API call or a DB query. I am **not** looking for the active users count or logged in users count, only the purchased license count. I know I can see that value if I login to the UI. But I am looking for an option to get that value to add it into an automation which I am trying.

Regards,

Anoop


author: Shannon S
body: Anoop,

1. It is not currently possible to do this through API, per the feature request.
2. The article I sent you does show how to get the total users that count towards the license. Are you asking how to find out the total number of licenses you have, regardless if they're being used or not?

I won't be able to help you specifically with your automation but I can help point you in the direction of finding this in the database.

Regards,

Shannon


author: Anoop K Baby
body: The article I sent you does show how to get the total users that count towards the license. Are you asking how to find out the total number of licenses you have, regardless if they're being used or not? -----\> Yes, exactly


author: Shannon S
body: Anoop,

Thank you for verifying.

I'm not sure how to do that, but there appears to be a way within Jira, so the Confluence app may be similar in REST API?

* [How to access UPM REST API for License Details](https://confluence.atlassian.com/jirakb/how-to-access-upm-rest-api-for-license-details-777021716.html?_ga=2.233327902.1805824230.1517845659-306096126.1516091163)

I wasn't able to determine specifically that might be in the database. Your question has been tagged so that our Developer Community can have a look and let you know if they have any advice.

Regards,

Shannon


author: Anoop K Baby
body: Hmm ok .. I had seen this thread ([How to access UPM REST API for License Details](https://confluence.atlassian.com/jirakb/how-to-access-upm-rest-api-for-license-details-777021716.html?_ga=2.84017371.390952301.1517849012-1732044338.1508861704)) earlier, but it will show only the license info for the Addons


author: Shannon S
body: Hi Anoop,

I consulted one of our developers, and she said that the [REST API Browser](https://marketplace.atlassian.com/plugins/com.atlassian.labs.rest-api-browser/server/overview) may be able to help you find what you need.

You can use this to see what is being called in the API when it retrieves your license details.

Could you take a look at that and see if it helps you find what you need?

Regards,

Shannon


author: Narra Sreenu
body: Hey I have also same requirement. I need to get used licenses count either by using db script or api. Please help me to achieve this.


Tags: developer