# Retriving specific fields using /api/v2/users endpoint

**URL:** <https://community.auth0.com/t/retriving-specific-fields-using-api-v2-users-endpoint/83491>\
**Category:** Get Help\
**Tags:** api, auth0\
**Created:** [May 16, 2022, 12:17pm UTC](https://community.auth0.com/t/retriving-specific-fields-using-api-v2-users-endpoint/83491 "2022-05-16T12:17:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aloysius](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aloysius/32/37178_2.png) [@aloysius](https://community.auth0.com/u/aloysius)\
**Post date:** [May 16, 2022, 12:17pm UTC](https://community.auth0.com/t/retriving-specific-fields-using-api-v2-users-endpoint/83491/1 "2022-05-16T12:17:41Z")

</div>

Hi,

I am using a method to get the list of all the users as below,

```auto
@GetMapping(value="/users")
    @ResponseBody
    public ResponseEntity<String> users(HttpServletRequest request, HttpServletResponse response) {

        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.set("Authorization", "Bearer " + controller.getManagementApiToken());

        HttpEntity<String> entity = new HttpEntity<String>(headers);

        RestTemplate restTemplate = new RestTemplate();
        ResponseEntity<String> result = restTemplate.exchange("https://" + domain + "/api/v2/users", HttpMethod.GET, entity, String.class);
        System.out.println(result);
        return result;

    }

```

Now, in the documentation, it was mentioned that we can select specific fields and only retrive those. How can I do this? I tried to set the parameters in the headers (both ‘fields’ and ‘include\_fields’) but it’s not getting the expected result. I am just starting to use this. Would love to get an answer.

Thank you!

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [May 16, 2022, 7:12pm UTC](https://community.auth0.com/t/retriving-specific-fields-using-api-v2-users-endpoint/83491/3 "2022-05-16T19:12:57Z")

</div>

Hi @aloysius ,

Thank you for posting this topic on the Auth0 Community!

To select specific fields with the /api/v2/users endpoint, please add the fields parameter. For example,

`https://{domain}/api/v2/users?fields=email,name` will only retrieve email and name.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/4/24db3fd14353b0006d7c9736e9f345946d0da71c.jpeg)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![aloysius](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aloysius/32/37178_2.png) [@aloysius](https://community.auth0.com/u/aloysius)\
**Post date:** [May 16, 2022, 7:35pm UTC](https://community.auth0.com/t/retriving-specific-fields-using-api-v2-users-endpoint/83491/4 "2022-05-16T19:35:09Z")

</div>

Hi @lihua.zhang ,

Good day to you!

I was able to implement it without any issue using the method you mentioned.

Thank you for the quick reply.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 22, 2022, 11:32am UTC](https://community.auth0.com/t/retriving-specific-fields-using-api-v2-users-endpoint/83491/5 "2022-12-22T11:32:55Z")

</div>


