# Is there a way to retrieve more than 1000 users using Dynatrace API's usersession endpoint?

**URL:** <https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561>\
**Category:** Real User Monitoring\
**Tags:** user-actions, user-sessions, dynatrace-api\
**Created:** [May 7, 2019, 12:12pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561 "2019-05-07T12:12:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dparkar](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dparkar](https://community.dynatrace.com/u/dparkar)\
**Post date:** [May 7, 2019, 12:12pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561/1 "2019-05-07T12:12:58Z")

</div>

We are using the following query to get names of all the users:

SELECT distinct(userid) FROM usersession where useraction.application=‘\<ApplicationName\>’ GROUP BY userid

However only 1000 users are retrieved.

Is there a way to retrieve all the users at once or if not possible are there means to retrieve all users in small batches and iterating until the last user is fetched?

PS: Tried using LIMIT at the end of the query.

Using Limit 10 or Limit 100 or Limit 500 works and only that many users are fetched

Using LIMIT 1000 or more doesnt work.

There is a limit of 1000 users(rows) in the json response

---

<div class="post-metadata">

**Author:** ![trevor\_masseng1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/trevor_masseng1/32/2442_2.png) [@trevor\_masseng1](https://community.dynatrace.com/u/trevor_masseng1)\
**Post date:** [May 7, 2019, 12:45pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561/2 "2019-05-07T12:45:59Z")

</div>

The API has certain limitations built in to protect the Dynatrace Cluster from experiencing any performance degradation from requests that are too large.  
To get around this, my suggestion would be to use regex to pull users who’s user id start with a particular character, then do this iteratively for each character that is allowed by the app (a-z, 0-9).

This should break the response up into smaller chunks.  
Another option would be to add more specific criteria to your API call if there is a certain type of user or activity that you are looking for.  
If neither of these suggestions work for you, feel free to submit an RFE to allow for a larger amount of rows to be returned.

---

<div class="post-metadata">

**Author:** ![dparkar](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dparkar](https://community.dynatrace.com/u/dparkar)\
**Post date:** [May 7, 2019, 1:39pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561/3 "2019-05-07T13:39:15Z")

</div>

But DQL doesn’t support functions like CONTAINS, LIKE, STARTSWITH etc. so that I would have iterated using the first names.

---

<div class="post-metadata">

**Author:** ![dparkar](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dparkar](https://community.dynatrace.com/u/dparkar)\
**Post date:** [May 7, 2019, 1:43pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561/4 "2019-05-07T13:43:51Z")

</div>

Okay the below query helps.

SELECT distinct(userid) FROM usersession where useraction.application=‘OMK’ and userid startswith ‘A’ GROUP BY userid limit 1000

Used limit 1000 to get more than 50 rows.

Thanks for your answer 🙂

---

<div class="post-metadata">

**Author:** ![dominik\_stadler](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dominik_stadler/32/8537_2.png) [@dominik\_stadler](https://community.dynatrace.com/u/dominik_stadler)\
**Post date:** [May 7, 2019, 1:51pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561/5 "2019-05-07T13:51:25Z")

</div>

With version 1.159 we increased this limit to 5000.

---

<div class="post-metadata">

**Author:** ![dparkar](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dparkar](https://community.dynatrace.com/u/dparkar)\
**Post date:** [May 9, 2019, 7:49am UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561/6 "2019-05-09T07:49:35Z")

</div>

Hi Dominik,

Thanks for your response.

We are using version 1.164

---

<div class="post-metadata">

**Author:** ![omar\_sheikh](https://avatars.discourse-cdn.com/v4/letter/o/5e9695/32.png) [@omar\_sheikh](https://community.dynatrace.com/u/omar_sheikh)\
**Post date:** [May 21, 2021, 9:20am UTC](https://community.dynatrace.com/t/is-there-a-way-to-retrieve-more-than-1000-users-using-dynatrace-apis-usersession-endpoint/20561/7 "2021-05-21T09:20:20Z")

</div>

Has this limit changed now?
