# Trying to retrieve all users in a Database

**URL:** <https://community.auth0.com/t/trying-to-retrieve-all-users-in-a-database/111191>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [July 13, 2023, 11:26am UTC](https://community.auth0.com/t/trying-to-retrieve-all-users-in-a-database/111191 "2023-07-13T11:26:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![carl.t](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@carl.t](https://community.auth0.com/u/carl.t)\
**Post date:** [July 13, 2023, 11:26am UTC](https://community.auth0.com/t/trying-to-retrieve-all-users-in-a-database/111191/1 "2023-07-13T11:26:51Z")

</div>

Using the below endpoint, i only get back 50 records out of 500. Why?

“[https://xxxxxxxx/api/v2/users?q=identities.connection:](https://xxxxxxxx/api/v2/users?q=identities.connection:)” + Auth0DbConnectionName

I cant find info on why only 50 are returned.

---

<div class="post-metadata">

**Author:** ![sylvainf](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sylvainf/32/35478_2.png) [@sylvainf](https://community.auth0.com/u/sylvainf)\
**Post date:** [July 26, 2023, 5:25pm UTC](https://community.auth0.com/t/trying-to-retrieve-all-users-in-a-database/111191/3 "2023-07-26T17:25:08Z")

</div>

Hi @carl.t

That’s probably because you only grab the first page of the results and without using the `per_page` parameter documented [here](https://auth0.com/docs/api/management/v2/users/get-users), this value is set to 50.

In other words, use the `page` param to grab the next page until you get all records, and if you need more (or less) records per page, use the `per_page` param.

Keep in mind that even with pagination you’re limited to 1000 total records so you might want to use several queries with predefined filters (loop on first letter of alphabet for example) or use a [User export](https://auth0.com/docs/api/management/v2/jobs/post-users-exports) instead.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 9, 2023, 5:25pm UTC](https://community.auth0.com/t/trying-to-retrieve-all-users-in-a-database/111191/4 "2023-08-09T17:25:50Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
