# Searching users using metadata values as search criteria

**URL:** <https://community.auth0.com/t/searching-users-using-metadata-values-as-search-criteria/84424>\
**Category:** Get Help\
**Tags:** user-search, users, search\
**Created:** [June 1, 2022, 7:31pm UTC](https://community.auth0.com/t/searching-users-using-metadata-values-as-search-criteria/84424 "2022-06-01T19:31:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sargent\_D](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sargent_d/32/12814_2.png) [@Sargent\_D](https://community.auth0.com/u/Sargent_D)\
**Post date:** [June 1, 2022, 7:31pm UTC](https://community.auth0.com/t/searching-users-using-metadata-values-as-search-criteria/84424/1 "2022-06-01T19:31:56Z")

</div>

I am trying to find a way to search users using certain values in the metadata fields. From what I have read and understood so far, the query string for searching for any field should be something like `app_metadata.<property name>:<search value>`. But when I run this query in the API explorer, I get an empty response:

Here’s the response for reference:

Request: [https://REDACTED.auth0.com/api/v2/users?page=0&per\_page=20&include\_totals=true&q=app\_metadata.sa-user-id%3A1234&search\_engine=v3](https://REDACTED.auth0.com/api/v2/users?page=0&per_page=20&include_totals=true&q=app_metadata.sa-user-id%3A1234&search_engine=v3)

Query string: app\_metadata.sa-user-id:1234

Here, sa-user-id is a custom field in app metadata with a string value 1234.

Response:

```auto
{
  "start": 0,
  "limit": 20,
  "length": 0,
  "users": [],
  "total": 0
}

```

I have checked and rechecked and the values I have passed and the field and property names are correct, but I still get an empty response.

I have refered to the following resources:

> **[Search for Users](https://auth0.com/docs/manage-users/user-search)**
>
> Understand how the Auth0 Management API search endpoints allow you to search for and retrieve user profiles.

> **[User Search Query Syntax](https://auth0.com/docs/manage-users/user-search/user-search-query-syntax)**
>
> Describes Auth0's user search query string syntax.

But none of these are helpful as to what the correct syntax is or why the response is blank.

If I am doing something wrong, can someone please let me know what’s the correct way to search metadata fields?

---

<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:** [June 1, 2022, 8:12pm UTC](https://community.auth0.com/t/searching-users-using-metadata-values-as-search-criteria/84424/3 "2022-06-01T20:12:16Z")

</div>

Hi @Sargent_D ,

Thank you for posting this topic on the Auth0 Community!

I tested the Search endpoint and it works for me. Here are the details.

![image](https://global.discourse-cdn.com/auth0/original/3X/1/0/10536fd5ffb5e7431c271db1d13c5db48882b49d.png)

`q: app_metadata.sa-user-id:"1234"`

Could you please try adding double quotes around `1234` and see if it works? Thank you.

---

<div class="post-metadata">

**Author:** ![Sargent\_D](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sargent_d/32/12814_2.png) [@Sargent\_D](https://community.auth0.com/u/Sargent_D)\
**Post date:** [June 2, 2022, 5:52am UTC](https://community.auth0.com/t/searching-users-using-metadata-values-as-search-criteria/84424/4 "2022-06-02T05:52:11Z")

</div>

That’s weird, it didn’t work for me the last time even with the quotes but it works now. Perhaps it was an issue with the API token for the wrong tenant.

My bad, I am pretty new to using the management API.

---

<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:** [June 2, 2022, 4:03pm UTC](https://community.auth0.com/t/searching-users-using-metadata-values-as-search-criteria/84424/5 "2022-06-02T16:03:08Z")

</div>

Glad to know it’s working now 👏

---

<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 21, 2022, 4:07pm UTC](https://community.auth0.com/t/searching-users-using-metadata-values-as-search-criteria/84424/6 "2022-12-21T16:07:57Z")

</div>


